home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / acpi / sonybright.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2006-10-15  |  746 b   |  27 lines

  1. #!/bin/bash
  2.  
  3. BRIGHTNESS=$(cat /proc/acpi/sony/brightness)
  4.  
  5. if [ "$BRIGHTNESS" -gt 8 ]; then
  6.     BRIGHTNESS=1
  7. fi
  8.  
  9. if [ "x$1" = "xdown" ]; then
  10.    if [ "x$BRIGHTNESS" != "x1" ]; then
  11.       BRIGHTNESS=$(( $BRIGHTNESS - 1 ))
  12.       echo $BRIGHTNESS > /proc/acpi/sony/brightness
  13.    else
  14.       [ -x /usr/bin/spicctrl ] && /usr/bin/spicctrl -b 0   
  15.    fi
  16.    # Recent nvidia Sonys have ACPI methods that do nothing. Thanks, Sony.
  17.    [ -x /usr/bin/smartdimmer ] && smartdimmer -d 2>/dev/null
  18. elif [ "x$1" = "xup" ]; then
  19.    if [ "x$BRIGHTNESS" != "x8" ]; then
  20.       BRIGHTNESS=$(( $BRIGHTNESS + 1 ))
  21.       echo $BRIGHTNESS > /proc/acpi/sony/brightness
  22.    fi
  23.    [ -x /usr/bin/smartdimmer ] && smartdimmer -i 2>/dev/null
  24. else
  25.    echo >&2 Unknown argument $1
  26. fi
  27.