FollieHiyuki-dotfiles/home/.local/bin/brightness

27 lines
900 B
Plaintext
Raw Normal View History

2021-02-13 11:28:59 -05:00
#!/bin/bash
if [ -z "$WAYLAND_DISPLAY" ]; then
notification=dunst
else
notification=mako
fi
case $1 in
up)
if command -v light >/dev/null
then
light -A 5 > /dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(light -G | cut -d '.' -f 1)%"
else
brightnessctl set 5%+ >/dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')%"
fi ;;
down)
if command -v light >/dev/null
then
light -U 5 > /dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(light -G | cut -d '.' -f 1)%"
else
brightnessctl set 5%- >/dev/null && notify-send -i ~/.config/${notification}/idea.png "Brightness: $(brightnessctl i | grep '%' | awk -F'(' '{print $2}' | awk -F'%' '{print $1}')%"
fi ;;
*)
;;
esac