Files
nixos-migration/config/hypr/scripts/opacity.sh
2026-06-15 00:24:26 +03:00

22 lines
519 B
Bash
Executable File

#!/bin/bash
# Usage: opacity.sh [increase|decrease]
STEP=0.1
ADDRESS=$(hyprctl activewindow -j | grep -oP '"address": "\K[^"]+')
CURRENT=$(hyprctl getprop active opacity | grep -oP '[\d.]+' | head -1)
if [[ -z "$CURRENT" ]]; then
CURRENT=1.0
fi
if [[ "$1" == "increase" ]]; then
NEW=$(echo "$CURRENT + $STEP" | bc)
else
NEW=$(echo "$CURRENT - $STEP" | bc)
fi
# Clamp between 0.1 and 1.0
NEW=$(echo "if ($NEW > 1.0) 1.0 else if ($NEW < 0.1) 0.1 else $NEW" | bc)
hyprctl dispatch setprop active opacity "$NEW"