FollieHiyuki-dotfiles/home/.local/bin/brightness
2021-02-13 19:28:59 +03:00

27 lines
900 B
Bash
Executable File

#!/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