mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-12-02 04:08:30 -05:00
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
_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}"
|
|
}
|
|
|
|
case $1 in
|
|
up)
|
|
if command -v light >/dev/null
|
|
then
|
|
light -A 5 >/dev/null
|
|
brightness="$(light -G | cut -d '.' -f 1)"
|
|
_notify_brightness "$brightness"
|
|
elif command -v brightnessctl >/dev/null
|
|
then
|
|
brightnessctl set 5%+ >/dev/null
|
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
|
_notify_brightness "$brightness"
|
|
else
|
|
brillo -l -A 5 >/dev/null
|
|
brightness="$(brillo -G | cut -d '.' -f 1)"
|
|
_notify_brightness "$brightness"
|
|
fi ;;
|
|
down)
|
|
if command -v light >/dev/null
|
|
then
|
|
light -U 5 >/dev/null
|
|
brightness="$(light -G | cut -d '.' -f 1)"
|
|
_notify_brightness "$brightness"
|
|
elif command -v brightnessctl >/dev/null
|
|
then
|
|
brightnessctl set 5%- >/dev/null
|
|
brightness="$(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')"
|
|
_notify_brightness "$brightness"
|
|
else
|
|
brillo -l -U 5 >/dev/null
|
|
brightness="$(brillo -G | cut -d '.' -f 1)"
|
|
_notify_brightness "$brightness"
|
|
fi ;;
|
|
*)
|
|
;;
|
|
esac
|