diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-05-10 19:49:57 +0100 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-05-10 19:49:57 +0100 |
commit | ccb081f4f40f71e5db09be082e69af9e25e84e41 (patch) | |
tree | 629268600e4eaad968886fc29f6dc012a68a210d /.config/eww/scripts/brightnesscontrol | |
parent | fb3afe0023747f7f7f8f85dfa0a38baf61cbfb71 (diff) |
Updates for using eww as the bar for sway
Diffstat (limited to '.config/eww/scripts/brightnesscontrol')
-rwxr-xr-x | .config/eww/scripts/brightnesscontrol | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/.config/eww/scripts/brightnesscontrol b/.config/eww/scripts/brightnesscontrol index 1f66f9d..2b51c75 100755 --- a/.config/eww/scripts/brightnesscontrol +++ b/.config/eww/scripts/brightnesscontrol @@ -9,14 +9,15 @@ # https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a function send_notification { - icon=/usr/share/icons/Papirus-Dark/16x16/actions/brightnesssettings.svg - brightness=$(brightnessctl -P g) + icon=/usr/share/icons/Adwaita/symbolic/status/daytime-sunrise-symbolic.svg + brightness=$(brightnessctl g) + brightness=$((brightness *100 / 255 )) brightness=$(echo "$brightness" | awk '{print ($0-int($0)<0.499)?int($0):int($0)+1}') # Make the bar with the special character ─ (it's not dash -) # https://en.wikipedia.org/wiki/Box-drawing_character bar=$(seq -s "─" 0 $((brightness / 10 )) | sed 's/[0-9]//g') # Send the notification - notify-send -i "$icon" -r 5555 -u normal "$bar $brightness" + notify-send -i "$icon" --hint=string:x-canonical-private-synchronous:brightness -u normal "$bar $brightness" } case $1 in @@ -24,16 +25,17 @@ case $1 in # increase the backlight by 5% brightnessctl s +5% send_notification - canberra-gtk-play -i audio-volume-change + # canberra-gtk-play -i audio-volume-change ;; down) # decrease the backlight by 5% brightnessctl s 5%- send_notification - canberra-gtk-play -i audio-volume-change + # canberra-gtk-play -i audio-volume-change ;; *) - brightness=$(brightnessctl -P g) + brightness=$(brightnessctl g) + brightness=$((brightness *100 / 255 )) brightness=$(echo "$brightness" | awk '{print ($0-int($0)<0.499)?int($0):int($0)+1}') icon="" printf "%s" "$icon $brightness" "%" |