merge x-brightness scripts
This commit is contained in:
26
.local/bin/x-brightness
Executable file
26
.local/bin/x-brightness
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
[ -z "$AMOUNT" ] && AMOUNT=5
|
||||
|
||||
notify() {
|
||||
notify-send "$@" -h string:x-dunst-stack-tag:'brightnessctl' -a 'brightnessctl'
|
||||
}
|
||||
|
||||
max=$(brightnessctl max)
|
||||
br=$(brightnessctl get)
|
||||
brp=$((100 * br / max))
|
||||
|
||||
case "$1" in
|
||||
up) brp=$((brp + AMOUNT)) ;;
|
||||
down) brp=$((brp - AMOUNT)) ;;
|
||||
*)
|
||||
echo 'E: could not decide what brightness action to perform!' >&2
|
||||
notify 'could not decide what audio action to perform!' -u critical -t 5000
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
brp=$((brp - (brp % AMOUNT)))
|
||||
|
||||
brightnessctl set $brp%
|
||||
ico=display-brightness-symbolic
|
||||
notify -u low -i "$ico" -h "int:value:$brp" "brightness: $brp%"
|
||||
Reference in New Issue
Block a user