config_sway/bin/sway_brightness

41 lines
952 B
Text
Raw Permalink Normal View History

2021-01-03 13:18:37 +01:00
#!/bin/bash
2021-01-04 18:46:33 +01:00
source $HOME/.config/sway/bin/sway_helpers
2021-01-03 13:18:37 +01:00
DEVICE=sysfs/backlight/intel_backlight
NOTIFY_APP="dunstify -a brightness -h string:x-dunst-stack-tag:brightness"
ICON=$HOME/.local/share/icons/Tela-circle-dark/16/panel/xfpm-brightness-lcd.svg
2023-12-20 07:58:49 +01:00
APP="/usr/bin/brightnessctl"
APP_INC="$APP s 10%+"
APP_DEC="$APP s 10%-"
PRG1="●"
PRG2="◌"
2023-12-20 07:58:49 +01:00
function _get_br() {
$APP | grep -oE '[0-9]*%' | sed 's/%//g'
}
## main
_log BRIGHTNESS INFO args: $*
_check_app $APP
2021-01-03 13:18:37 +01:00
case $1 in
d*)
2023-12-20 07:58:49 +01:00
$APP_DEC &> /dev/null
BR=$(_get_br)
echo $BR
$NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
2021-01-03 13:18:37 +01:00
;;
i*)
2023-12-20 07:58:49 +01:00
$APP_INC &> /dev/null
BR=$(_get_br)
echo $BR
$NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
2021-01-03 13:18:37 +01:00
;;
"-h"|"--help")
echo "arguments: [decrease|increase]"
2021-01-03 13:18:37 +01:00
;;
*)
2023-12-20 07:58:49 +01:00
BR=$($APP_BR)
$NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
;;
2021-01-03 13:18:37 +01:00
esac