Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script to toggle touchpad on/off
read TPdevice <<< $( xinput | sed -nre '/TouchPad/s/.*id=([0-9]*).*/\1/p' )
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" )
if [ "$state" -eq '1' ];then
xinput --disable "$TPdevice"
notify-send Touchpad Disabled
xinput --enable "$TPdevice"
notify-send Touchpad Enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment