diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2024-07-07 06:34:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-07 06:34:41 +0900 |
| commit | 1d425834fe4c759ca0c2361dd24cd807b518c216 (patch) | |
| tree | 38d448de0737c496c215440d89cc7c574e41d470 /config/hypr/scripts | |
| parent | ce9b8df597095e68c3d5878a931a0f7619f8eaf5 (diff) | |
| parent | e9babc040992e94195d3a6f48b7eaa25e425c505 (diff) | |
Merge pull request #366 from JaKooLit/main
main to ags-dev
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 |
