-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbright
executable file
·33 lines (32 loc) · 886 Bytes
/
bright
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
#!/bin/bash
# Author: CrazyA
# Needed something for my HP dm1 because brightness keys didn't work out of the box
#
# Add this to your /etc/rc.local so we can actually write here as a regular user
# chmod go+w /sys/class/backlight/acpi_video0/brightness
#
# Bind 'bright -' and 'bright +' to some keyboard shortcuts and enjoy
#
CURRENT=`cat /sys/class/backlight/acpi_video0/brightness`
if [ -z "$1" ]; then
echo $CURRENT
else
if [ $1 = "+" ]; then
MAX=`cat /sys/class/backlight/acpi_video0/max_brightness`
if [ $CURRENT -lt $MAX ]; then
NEW=$(expr $CURRENT + 1)
echo $NEW > /sys/class/backlight/acpi_video0/brightness
echo $NEW
else
echo $CURRENT
fi
else
if [ $CURRENT -gt 0 ]; then
NEW=$(expr $CURRENT - 1)
echo $NEW > /sys/class/backlight/acpi_video0/brightness
echo $NEW
else
echo $CURRENT
fi
fi
fi