Skip to content

Instantly share code, notes, and snippets.

@Liblor
Created May 21, 2019 21:09
Show Gist options
  • Save Liblor/5ea857f44c1070ac3d9d0c99b9df71c1 to your computer and use it in GitHub Desktop.
Save Liblor/5ea857f44c1070ac3d9d0c99b9df71c1 to your computer and use it in GitHub Desktop.
Brightness notification (progressbar): dunst
#!/usr/bin/bash
# Brightness notification: dunst
icon_path=/usr/share/icons/Adwaita/64x64/status/
notify_id=817
function get_brightness {
xbacklight -get
}
function brightness_notification {
brightness=`get_brightness`
printf -v br_int %.0f "$brightness"
echo $br_int
bar=$(seq -s "─" $(($br_int / 5)) | sed 's/[0-9]//g')
dunstify -r $notify_id -u low -i ${icon_path}display-brightness-symbolic.symbolic.png $bar
}
case $1 in
up)
xbacklight -inc 5
brightness_notification
;;
down)
xbacklight -dec 5
brightness_notification
;;
*)
echo "Usage: $0 up | down "
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment