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
|
2021-05-13 23:47:26 +02:00
|
|
|
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%-"
|
2021-05-13 23:47:26 +02:00
|
|
|
PRG1="●"
|
|
|
|
PRG2="◌"
|
2021-01-04 18:27:42 +01:00
|
|
|
|
2023-12-20 07:58:49 +01:00
|
|
|
function _get_br() {
|
|
|
|
$APP | grep -oE '[0-9]*%' | sed 's/%//g'
|
|
|
|
}
|
|
|
|
|
2021-01-04 18:27:42 +01:00
|
|
|
## 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
|
2021-05-13 23:47:26 +02:00
|
|
|
$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
|
2021-05-13 23:47:26 +02:00
|
|
|
$NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
|
2021-01-03 13:18:37 +01:00
|
|
|
;;
|
2021-05-13 23:47:26 +02:00
|
|
|
"-h"|"--help")
|
2021-01-04 18:27:42 +01:00
|
|
|
echo "arguments: [decrease|increase]"
|
2021-01-03 13:18:37 +01:00
|
|
|
;;
|
2021-05-13 23:47:26 +02:00
|
|
|
*)
|
2023-12-20 07:58:49 +01:00
|
|
|
BR=$($APP_BR)
|
2021-05-13 23:47:26 +02:00
|
|
|
$NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
|
|
|
|
;;
|
2021-01-03 13:18:37 +01:00
|
|
|
esac
|