if [ `ls -al /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness | awk {'print $1'}` != -rwxrwxrwx ]; then
gksudo chmod 777 /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
fi
$act
act=`cat /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness`
echo $1
case "$1" in
inc)
if [[ $act -lt 255 ]]; then
act=$((act+5))
echo $act | tee /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
#else
#notify-send -t 50 "Keyboard backlight is on maximum!"
fi
;;
dec)
if [[ $act -gt 4 ]]; then act=$((act-5)) echo $act | tee /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
#else
#notify-send -t 50 "Keyboard backlight is off."
fi
;;
*) echo "Usage: inc or dec"
;;
esac
The else and the notify-send is commented out, because of a bug in notify-osd package. This bug causes notify-osd to ignore the timeout settings.
I had to make a little modification for the script so it will work after reboot too:
stoto@stoto- laptop: ~$ cat backlight.sh
#!/bin/bash
if [ `ls -al /sys/devices/ platform/ applesmc. 768/leds/ smc::kbd_ backlight/ brightness | awk {'print $1'}` != -rwxrwxrwx ]; then platform/ applesmc. 768/leds/ smc::kbd_ backlight/ brightness
gksudo chmod 777 /sys/devices/
fi
$act platform/ applesmc. 768/leds/ smc::kbd_ backlight/ brightness` platform/ applesmc. 768/leds/ smc::kbd_ backlight/ brightness
act=`cat /sys/devices/
echo $1
case "$1" in
inc)
if [[ $act -lt 255 ]]; then
act=$((act+5))
echo $act | tee /sys/devices/
#else
#notify-send -t 50 "Keyboard backlight is on maximum!"
fi
;;
dec)
act= $((act- 5))
echo $act | tee /sys/devices/ platform/ applesmc. 768/leds/ smc::kbd_ backlight/ brightness
if [[ $act -gt 4 ]]; then
#else
#notify-send -t 50 "Keyboard backlight is off."
fi
;;
*) echo "Usage: inc or dec"
;;
esac
The else and the notify-send is commented out, because of a bug in notify-osd package. This bug causes notify-osd to ignore the timeout settings.