Created
August 7, 2019 19:04
-
-
Save dnisyd/6cd41bab75fa9bc4c0a199c178dc6f4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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