diff options
Diffstat (limited to '.local')
| -rw-r--r-- | .local/bin/statusbar/sb-bghitness | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/.local/bin/statusbar/sb-bghitness b/.local/bin/statusbar/sb-bghitness index afccf3e..913387b 100644 --- a/.local/bin/statusbar/sb-bghitness +++ b/.local/bin/statusbar/sb-bghitness @@ -1,13 +1,23 @@ #!/bin/sh -# show the current brightness level. +# current brightness +curr_brightness=$(cat /sys/class/backlight/*/brightness) -case $BLOCK_BUTTON in - 1) setsid -w -f "$TERMINAL" -e brightnessctl; pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}" ;; - 3) notify-send "💡 Brightness module" "\- Shows brightness level ☀️." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esact +# max_brightness +max_brightness=$(cat /sys/class/backlight/*/max_brightness) + +# brightness percentage +brightness_per=$((100 * curr_brightness / max_brightness)) -brightness=$(brightnessctl -m | grep -m 1 "backlight" | cut -d "," -f 4) +case $BLOCK_BUTTON in + 1) + ;; + 3) + notify-send "💡 Brightness module" "\- Shows current brightness level ☀️." + ;; + 6) + setsid -f "$TERMINAL" -e "$EDITOR" "$0" + ;; +esac -echo "💡 $brightness" +echo "💡 ${brightness_per}%" |
