-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbacklight
43 lines (37 loc) · 1.13 KB
/
backlight
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
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
max=$(cat /sys/class/backlight/*/max_brightness)
current=$(cat /sys/class/backlight/*/brightness)
if [ "$1" == + ]
then
if [ $current == $max ]
then
notify-send -t 1000 "Brightness maxed"
else
let current=$current+1
echo $current | sudo tee /sys/class/backlight/*/brightness
notify-send -t 1000 "Brightness is now set at $current"
fi
fi
if [ "$1" == - ]
then
if [ $current == 0 ]
then
notify-send -t 1000 "Brightness already as low as it can. How are you seeing this"
else
let current=$current-1
echo $current | sudo tee /sys/class/backlight/*/brightness
notify-send -t 1000 "Brightness is now set at $current"
fi
fi
if [ "$1" == high ]
then
echo $max | sudo tee /sys/class/backlight/*/brightness
notify-send -t 1000 "Brightness maxed"
fi
if [ "$1" == low ]
then
low=$(echo $(( $max / 10 )))
echo $low | sudo tee /sys/class/backlight/*/brightness
notify-send -t 1000 "Brightness set to $low"
fi
echo "This is a simple script to change the backlight. Pass + to increase brightness by 1, - to decrease brightness by 1, high to max brightness, and low to put to 10%."