Script for handling backlight

This commit is contained in:
RealStickman 2020-10-10 21:33:28 +02:00
parent 910df527ed
commit 56c51002e3

View File

@ -0,0 +1,31 @@
#!/bin/bash
# You can call this script like this:
# $./dunst-backlight.sh up
# $./dunst-backlight.sh down
get_light() {
xbacklight -get
}
send_notification() {
light=$(get_light)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "─" $(($light/ 5)) | sed 's/[0-9]//g')
# Send the notification
dunstify -i whitebalance -r 2489 " $bar"
}
case $1 in
up)
# Increase backlight
xbacklight -inc 10
send_notification
;;
down)
# Decrease backlight
xbacklight -dec 10
send_notification
;;
esac