Browse Source

Add brightness control script

master
krrishg 4 years ago
parent
commit
3b31ab5964
  1. 20
      brightness

20
brightness

@ -0,0 +1,20 @@
#!/bin/sh
brightness_dir="/sys/class/backlight/intel_backlight/brightness"
max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness`
current_brightness_level=`cat $brightness_dir`
new_brightness_level=`expr $current_brightness_level + $1`
if [ "$1" -ge 0 ]; then
if [ "$new_brightness_level" -le "$max_brightness" ]; then
echo $new_brightness_level > $brightness_dir
else
echo $max_brightness > $brightness_dir
fi
else
if [ "$new_brightness_level" -ge 0 ]; then
echo $new_brightness_level > $brightness_dir
else
echo 0 > $brightness_dir
fi
fi
Loading…
Cancel
Save