Ubuntu – How to Make an xinput Command Persistent After Standby

multi-touchsuspendtouchpad

I want to use two finger scrolling on my touchpad. I'm using Ubuntu 13.04, and the Mouse and Touchpad GUI configuration doesn't let me enable it (the checkbox is greyed out). As a workaround, I created a script that is run on startup per the advice. The script is:

xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1         
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 0

This works fine after I log in. However, when I sleep and resume, the setting seems to disappear — two finger scrolling is no longer enabled.

Some solutions (e.g.) suggest using synclient and xorg.conf, but those don't seem to work. Other solutions (e.g.) add scripts that are run upon resuming from sleep. This seems like the wrong way to go about it — there should be a way to make permanent changes without having to re-tweak them on every resume.

Does anyone have a permanent way to enable two finger scrolling?

Best Answer

You can add the script to /etc/X11/Xsession.d/ to make the change persist across all sessions. Just make sure you read up on how to customize Xsession's startup procedure (particularly the naming convention): http://manpages.ubuntu.com/manpages/raring/man5/Xsession.5.html