Last active
February 7, 2017 11:49
-
-
Save jensens/2b0413d979be5103c14d to your computer and use it in GitHub Desktop.
Linux Script to Toggle Thinkpad Touchpad on/off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# together with i3wm i bound this script to the blue thinkvantage button | |
# using: | |
# bindsym XF86Launch1 exec /usr/local/bin/toggle_touchpad.sh | |
# extract device id | |
DEVICE=`xinput --list|sed -n 's/.*SynPS\/2 Synaptics TouchPad.*id=\([0-9]*\).*/\1/p'` | |
# check its state | |
xinput list-props $DEVICE|egrep ^.*Device\ Enabled.*1$ >/dev/null | |
RESULT=$? | |
# toggle | |
if [ $RESULT -eq 0 ] | |
then | |
xinput disable $DEVICE | |
exit 0 | |
fi | |
xinput enable $DEVICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment