Comment 54 for bug 337945

Revision history for this message
Peter S. (stoto) wrote :

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
 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.