[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Save trackpad settings during sleep



Hey all.  I got tired of accidently highting text 'cuz I touched the trackpad
and forgot to re-run /sbin/trackpad after waking up the ibook, so I
wrote the following for /etc/power/pwrct-local.  I figured it might be of
use to others, so here it is:

logger=/usr/bin/logger

case "$1" in
sleep)
	[ -x /sbin/trackpad ] && {
		tempfile -n /var/run/trackpad || {
			$logger -p daemon.error -t pwrctl-local "$0: cannot create tempfile"
			exit 1
		}
		# Save the settings.
		/sbin/trackpad show | cut -d \  -f 5- > /var/run/trackpad
		# Make sure we write to disk
		sync
	}
;;
wakeup)
	[ -x /sbin/trackpad -a -f /var/run/trackpad ] && {
		# Sleep so that the devices get probed again
		sleep 2
		/sbin/trackpad `cat /var/run/trackpad`
		rm -f /var/run/trackpad
	}
;;
*)
;;
esac

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/



Reply to: