diff options
| author | JaKooLit <jimmielovejay@gmail.com> | 2023-10-22 15:55:57 +0900 |
|---|---|---|
| committer | JaKooLit <jimmielovejay@gmail.com> | 2023-10-22 15:55:57 +0900 |
| commit | c222e1bad2ba5e779c3af5b956906c82ead43271 (patch) | |
| tree | a5253e0861c200ff90354169e1f67ef42ebf0ef9 /config/hypr/scripts/Brightness.sh | |
| parent | bb0be21dba7980fc1c047eaba24eda1712bd7f31 (diff) | |
Initial upload
Diffstat (limited to 'config/hypr/scripts/Brightness.sh')
| -rwxr-xr-x | config/hypr/scripts/Brightness.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh new file mode 100755 index 00000000..040d1c72 --- /dev/null +++ b/config/hypr/scripts/Brightness.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +iDIR="$HOME/.config/dunst/icons" +notification_timeout=1000 + +# Get brightness +get_backlight() { + echo $(brightnessctl -m | cut -d, -f4) +} + +# Get icons +get_icon() { + current=$(get_backlight | sed 's/%//') + if [ "$current" -le "20" ]; then + icon="$iDIR/brightness-20.png" + elif [ "$current" -le "40" ]; then + icon="$iDIR/brightness-40.png" + elif [ "$current" -le "60" ]; then + icon="$iDIR/brightness-60.png" + elif [ "$current" -le "80" ]; then + icon="$iDIR/brightness-80.png" + else + icon="$iDIR/brightness-100.png" + fi +} + +# Notify +notify_user() { + notify-send -h string:x-dunst-stack-tag:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%" +} + +# Change brightness +change_backlight() { + brightnessctl set "$1" && get_icon && notify_user +} + +# Execute accordingly +case "$1" in + "--get") + get_backlight + ;; + "--inc") + change_backlight "+10%" + ;; + "--dec") + change_backlight "10%-" + ;; + *) + get_backlight + ;; +esac
\ No newline at end of file |
