diff options
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/Brightness.sh | 31 | ||||
| -rwxr-xr-x | config/hypr/scripts/GameMode.sh | 2 |
2 files changed, 27 insertions, 6 deletions
diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh index 8f9fbf22..d1f80932 100755 --- a/config/hypr/scripts/Brightness.sh +++ b/config/hypr/scripts/Brightness.sh @@ -4,15 +4,16 @@ iDIR="$HOME/.config/swaync/icons" notification_timeout=1000 +step=10 # INCREASE/DECREASE BY THIS VALUE # Get brightness get_backlight() { - echo $(brightnessctl -m | cut -d, -f4) + brightnessctl -m | cut -d, -f4 | sed 's/%//' } # Get icons get_icon() { - current=$(get_backlight | sed 's/%//') + current=$(get_backlight) if [ "$current" -le "20" ]; then icon="$iDIR/brightness-20.png" elif [ "$current" -le "40" ]; then @@ -33,7 +34,27 @@ notify_user() { # Change brightness change_backlight() { - brightnessctl set "$1" -n && get_icon && notify_user + local current_brightness + current_brightness=$(get_backlight) + + # Calculate new brightness + if [[ "$1" == "+${step}%" ]]; then + new_brightness=$((current_brightness + step)) + elif [[ "$1" == "${step}%-" ]]; then + new_brightness=$((current_brightness - step)) + fi + + # Ensure new brightness is within valid range + if (( new_brightness < 5 )); then + new_brightness=5 + elif (( new_brightness > 100 )); then + new_brightness=100 + fi + + brightnessctl set "${new_brightness}%" + get_icon + current=$new_brightness + notify_user } # Execute accordingly @@ -42,10 +63,10 @@ case "$1" in get_backlight ;; "--inc") - change_backlight "+10%" + change_backlight "+${step}%" ;; "--dec") - change_backlight "10%-" + change_backlight "${step}%-" ;; *) get_backlight diff --git a/config/hypr/scripts/GameMode.sh b/config/hypr/scripts/GameMode.sh index 5ad268ca..f8dc3505 100755 --- a/config/hypr/scripts/GameMode.sh +++ b/config/hypr/scripts/GameMode.sh @@ -20,7 +20,7 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then notify-send -e -u low -i "$notif" "gamemode enabled. All animations off" exit else - swww-daemon && swww img "$HOME/.config/rofi/.current_wallpaper" & + swww-daemon --format xrgb && swww img "$HOME/.config/rofi/.current_wallpaper" & sleep 0.1 ${SCRIPTSDIR}/WallustSwww.sh sleep 0.5 |
