Skip to content

Instantly share code, notes, and snippets.

@dnisyd
Created August 7, 2019 19:04
Show Gist options
  • Save dnisyd/6cd41bab75fa9bc4c0a199c178dc6f4c to your computer and use it in GitHub Desktop.
Save dnisyd/6cd41bab75fa9bc4c0a199c178dc6f4c to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
#source: https://gist.github.com/Blaradox/030f06d165a82583ae817ee954438f2e
id=5555
function get_brightness {
xbacklight -get | cut -d '.' -f 1
}
function send_notification {
icon="preferences-system-brightness-lock"
brightness=$(get_brightness)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
#bar=$(seq -s "█" 0 $((brightness / 5)) | sed 's/[0-9]//g')
# Send the notification
dunstify -t 1000 -i "$icon" -r $id -u normal "BRIGHTNESS: $brightness% "
}
case $1 in
up)
# increase the backlight by 5%
xbacklight -inc 5
send_notification
;;
down)
# decrease the backlight by 5%
xbacklight -dec 5
send_notification
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment