#!/bin/sh # # This script makes longrun change the cpu speed depending on whether # the AC adapter is connected or not. Also it adapts the screen bright- # ness, and it makes xscreensaver demanding less power. # Created for Sony Vaio PCG-C1MHP, by Kryz. http://kryz.org/vaio.html for # more information. status=`sed "s/stat.*: *//i" /proc/acpi/ac_adapter/ACAD/state` # Here the user running xscreensaver is determined. Make sure that # "xscreensaver -nosplash" is not found more than once in "ps", otherwise # the variable will not work. xscruser=`ps auxw | grep "xscreensaver -nosplash" | grep -v grep | awk '{print }'` case $status in "on-line" ) /usr/bin/longrun -s 0 100 /usr/bin/longrun -f performance su $xscruser "/usr/bin/xscreensaver-command -unthrottle" for CNT in `seq 50 5 255` do /usr/bin/spicctrl -b $CNT /bin/sleep 0.01 done exit 0 ;; "off-line" ) for CNT in `seq 255 -5 50` do /usr/bin/spicctrl -b $CNT /bin/sleep 0.01 done /usr/bin/longrun -s 0 33 /usr/bin/longrun -f economy su $xscruser "/usr/bin/xscreensaver-command -throttle" exit 0 ;; esac echo "Something bad happened!" exit 1