diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-05-10 19:45:25 +0100 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-05-10 19:45:25 +0100 |
commit | 14f12f5974394861430ed7f324552266156f7580 (patch) | |
tree | 62e3db728000660dc670f9a40f3f77ae25798557 /.config | |
parent | 310e349145b994ae6d03e0f0c4351773d6dfc66c (diff) |
Changed from light to brightnessctl
Diffstat (limited to '.config')
-rwxr-xr-x | .config/yambar/scripts/brightnesscontrol | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/.config/yambar/scripts/brightnesscontrol b/.config/yambar/scripts/brightnesscontrol index 718cb05..797a1db 100755 --- a/.config/yambar/scripts/brightnesscontrol +++ b/.config/yambar/scripts/brightnesscontrol @@ -9,34 +9,33 @@ # https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a function send_notification { - icon=/usr/share/icons/Papirus-Dark/16x16/actions/brightnesssettings.svg - brightness=$(light -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') - #brightness=$((brightness *100 / 255 )) - #echo $bar - #echo $test # 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 up) # increase the backlight by 5% - light -A 5 + brightnessctl s +5 send_notification #canberra-gtk-play -i audio-volume-change ;; down) # decrease the backlight by 5% - light -U 5 + brightnessctl s 5- send_notification #canberra-gtk-play -i audio-volume-change ;; *) - brightness=$(light -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" "%" |