Added brightness changing script
This commit is contained in:
parent
238f2c6eda
commit
43e094e25d
1 changed files with 22 additions and 0 deletions
22
.local/bin/change-brightness
Executable file
22
.local/bin/change-brightness
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness`
|
||||||
|
brightness=`cat /sys/class/backlight/intel_backlight/brightness`
|
||||||
|
increment=12000
|
||||||
|
|
||||||
|
if [ "$1" = "down" ]; then
|
||||||
|
new_brightness=$(($brightness - $increment))
|
||||||
|
if [ $new_brightness -lt 0 ]; then
|
||||||
|
new_brightness=0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
new_brightness=$(($brightness + $increment))
|
||||||
|
if [ $new_brightness -gt $max_brightness ]; then
|
||||||
|
new_brightness=$max_brightness
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $new_brightness > /sys/class/backlight/intel_backlight/brightness
|
||||||
|
ratio=$(( (new_brightness * 100) / max_brightness ))
|
||||||
|
notify-send -r 43 "Brightness: ${ratio}%"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue