Skip to content

Instantly share code, notes, and snippets.

@jensens
Last active February 7, 2017 11:49
Show Gist options
  • Save jensens/2b0413d979be5103c14d to your computer and use it in GitHub Desktop.
Save jensens/2b0413d979be5103c14d to your computer and use it in GitHub Desktop.
Linux Script to Toggle Thinkpad Touchpad on/off
#!/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