Added script to control screen brightness.

This commit is contained in:
Sheldon Lee 2021-09-15 00:45:24 +08:00
parent 856aa61e83
commit 1add6c3d32

View File

@ -0,0 +1,22 @@
#!/bin/bash
[ -z $IS_LAPTOP ] && exit
blpath=/sys/class/backlight/intel_backlight
if [ -z $1 ]
then
exit
elif (( $1 < 10 ))
then
perc=10
elif (( $1 > 100 ))
then
perc=100
else
perc=$1
fi
max=$(cat $blpath/max_brightness)
brightness="$(($max * $perc / 100))"
echo $brightness > $blpath/brightness