aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-02-21 19:14:43 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-02-21 19:14:43 +0000
commit07073fe3c6c283c5cf83eac0c16898cc48417ca6 (patch)
tree0b7db9d3b94eab895381af625c5b93a48aefc714
parent54fa912cfe721c884befdd6e8ba97ab75c333ebe (diff)
Replaced Light with Brightnessctl
-rwxr-xr-x.config/eww/scripts/brightnesscontrol11
1 files changed, 4 insertions, 7 deletions
diff --git a/.config/eww/scripts/brightnesscontrol b/.config/eww/scripts/brightnesscontrol
index 304c187..1f66f9d 100755
--- a/.config/eww/scripts/brightnesscontrol
+++ b/.config/eww/scripts/brightnesscontrol
@@ -10,14 +10,11 @@
function send_notification {
icon=/usr/share/icons/Papirus-Dark/16x16/actions/brightnesssettings.svg
- brightness=$(light -G)
+ brightness=$(brightnessctl -P g)
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"
}
@@ -25,18 +22,18 @@ function send_notification {
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 -P g)
brightness=$(echo "$brightness" | awk '{print ($0-int($0)<0.499)?int($0):int($0)+1}')
icon="󰃞"
printf "%s" "$icon $brightness" "%"