mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

xbl_adj (313B)


      1 #!/bin/bash
      2 # adjust backlight by an increment percentage
      3 
      4 DIR="/sys/class/backlight/intel_backlight/"
      5 MAX=$(cat $DIR/max_brightness)
      6 CUR=$(cat $DIR/brightness)
      7 ADJ=$1
      8 NEW=$(($CUR+$ADJ*$MAX/100))
      9 if [ $NEW -gt $MAX ]
     10 then
     11 	NEW=$MAX
     12 fi
     13 if [ $NEW -lt 0 ]
     14 then
     15 	NEW=0
     16 fi
     17 echo $NEW | tee $DIR/brightness > /dev/null
     18