Run script on resume from suspend

Put your script into

/etc/pm/sleep.d

with a number at the beginning and mark it executable. Here’s an example that sets my Thinkpad mouse sensitivity and enables two-fingered scrolling on my touchpad.

$ cat /etc/pm/sleep.d/99-trackpoint-and-twofinger
#!/bin/bash
case "$1" in
    thaw|resume)
	echo -n 220 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 2> /dev/null
	echo -n 95 > /sys/devices/platform/i8042/serio1/serio2/speed 2> /dev/null
	xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Pressure" 32 4
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Width" 32 7
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Scrolling" 8 1 1
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Jumpy Cursor Threshold" 32 250
        ;;
    *)
        ;;
esac
exit $?

Note that if you want to have the script run at boot as well you probably want to add your code to

/etc/rc.local

12/2/11