23 lines
306 B
Bash
23 lines
306 B
Bash
|
#!/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
|
||
|
|