Don't like ads? PRO users don't see any ads ;-)
Guest

Keylight

By: a guest on Jan 4th, 2011  |  syntax: Bash  |  size: 0.46 KB  |  hits: 157  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. VALUE=$(cat /sys/class/leds/smc::kbd_backlight/brightness)
  2. INCREMENT=15
  3.  
  4. case $1 in
  5.  
  6. up)
  7.         TOTAL=`expr $VALUE + $INCREMENT`
  8.         ;;
  9.  
  10. down)
  11.         TOTAL=`expr $VALUE - $INCREMENT`
  12.         ;;
  13. full)
  14.         TOTAL=255
  15.         ;;
  16. off)
  17.         TOTAL=0
  18.         ;;
  19. esac
  20.  
  21. if [ $TOTAL -gt 255 ]; then
  22.         echo "Value out of range (must be 0-255)"
  23.         exit 1
  24. fi
  25.  
  26. if [ $TOTAL -lt 0 ]; then
  27.         echo "Value out of range (must be 0-255)"
  28.         exit 1
  29. fi
  30.  
  31. echo $TOTAL > /sys/class/leds/smc::kbd_backlight/brightness