2021-02-24 21:55:12 -05:00
|
|
|
#!/bin/sh
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-02-24 21:55:12 -05:00
|
|
|
_notify_brightness() {
|
|
|
|
if command -v mako >/dev/null
|
|
|
|
then
|
|
|
|
icon="$HOME/.config/mako/idea.png"
|
|
|
|
else
|
|
|
|
icon="$HOME/.config/dunst/idea.png"
|
|
|
|
fi
|
|
|
|
notify-send -h string:x-canonical-private-synchronous:brightness "Brightness: $1%" -h int:value:"$1" -i "${icon}"
|
|
|
|
}
|
2021-02-13 11:28:59 -05:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
up)
|
|
|
|
if command -v light >/dev/null
|
|
|
|
then
|
2021-02-24 21:55:12 -05:00
|
|
|
light -A 5 >/dev/null
|
|
|
|
brightness="$(light -G | cut -d '.' -f 1)"
|
|
|
|
_notify_brightness "$brightness"
|
2021-02-13 11:28:59 -05:00
|
|
|
else
|
2021-02-24 21:55:12 -05:00
|
|
|
brightnessctl set 5%+ >/dev/null
|
|
|
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
|
|
|
_notify_brightness "$brightness"
|
2021-02-13 11:28:59 -05:00
|
|
|
fi ;;
|
|
|
|
down)
|
|
|
|
if command -v light >/dev/null
|
|
|
|
then
|
2021-02-24 21:55:12 -05:00
|
|
|
light -U 5 >/dev/null
|
|
|
|
brightness="$(light -G | cut -d '.' -f 1)"
|
|
|
|
_notify_brightness "$brightness"
|
2021-02-13 11:28:59 -05:00
|
|
|
else
|
2021-02-24 21:55:12 -05:00
|
|
|
brightnessctl set 5%- >/dev/null
|
|
|
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
|
|
|
_notify_brightness "$brightness"
|
2021-02-13 11:28:59 -05:00
|
|
|
fi ;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|