dotfiles/.config/wm_scripts/brightness.sh
2021-09-15 00:45:24 +08:00

23 lines
306 B
Bash
Executable File

#!/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