You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
600 B
23 lines
600 B
3 years ago
|
#!/bin/bash
|
||
|
|
||
|
case $1 in
|
||
|
up)
|
||
|
brightnessctl set 10%+
|
||
|
;;
|
||
|
down)
|
||
|
brightnessctl set --min-value=1 10%-
|
||
|
;;
|
||
|
off)
|
||
|
brightnessctl set 0
|
||
|
;;
|
||
|
max)
|
||
|
brightnessctl set 100%
|
||
|
;;
|
||
|
esac
|
||
|
ID_LOCATION=/run/user/$(id -u)/i3-helpers/brightness-notification-id
|
||
|
OLD_ID=$(<"$ID_LOCATION")
|
||
|
BRIGHTNESS=$(( $(brightnessctl get) * 100 / $(brightnessctl max) ))
|
||
|
NEW_ID=$(dunstify --appname=brightness.sh --timeout=3000 --hints="int:value:$BRIGHTNESS" --printid "${OLD_ID:+--replace="${OLD_ID}"}" "Brightness" "${BRIGHTNESS}%" )
|
||
|
mkdir -p $(dirname "$ID_LOCATION")
|
||
|
echo "$NEW_ID" >"$ID_LOCATION"
|