forked from sayan01/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbri
executable file
·30 lines (27 loc) · 776 Bytes
/
bri
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# control brightness
# this script uses xbacklight
# Usage
# bri -> outputs current brightness level
# bri up -> increases brightness
# bri down -> decreases brightness
# bri 90 -> sets brightness to 90
# bri +50 -> increases brightness by 50
# bri -10 -> decreases brightness by 10
# change this value to the number of levels you want brightness inc/dec to have
levels=5
inc=$((100/levels))
for args in "$@"; do
case $args in
-n) notify=true;;
up) arg="+$inc";;
down) arg="-$inc";;
*) arg=$args ;;
esac
done
if [ -n "$arg" ]; then xbacklight "$arg"; fi
nb=$(xbacklight -get)
if [ "$notify" == "true" ]; then
notify-send -a "bri" "Brightness" "🔆$nb%" -t 500 &
fi
echo "🔆 $nb" # display current(new if changed) brightness level