Skip to content

Instantly share code, notes, and snippets.

@Kaveh8
Last active August 31, 2023 00:26
Show Gist options
  • Save Kaveh8/0ad331a9e1a26d056b0e574c69d9487a to your computer and use it in GitHub Desktop.
Save Kaveh8/0ad331a9e1a26d056b0e574c69d9487a to your computer and use it in GitHub Desktop.
A bash script for disabling touchpad in Linux
#!/bin/bash
mouse=`xinput | grep 'Mouse' | cut -d$'\t' -f2`
touch=`xinput | grep 'Touchpad' | cut -d$'\t' -f2`
echo 'Mouse' $mouse
echo 'Touch' $touch
mouse_id=`echo $mouse | cut -d '=' -f 2`
touch_id=`echo $touch | cut -d '=' -f 2`
mouse_prop_id=`xinput list-props $mouse_id | grep 'Device Enabled' | cut -d '(' -f 2 | cut -d ')' -f 1`
touch_prop_id=`xinput list-props $touch_id | grep 'Device Enabled' | cut -d '(' -f 2 | cut -d ')' -f 1`
echo
echo 'Mouse'`xinput list-props $mouse_id | grep 'Device Enabled'`
echo 'Touch'`xinput list-props $touch_id | grep 'Device Enabled'`
echo
xinput set-prop $mouse_id $mouse_prop_id 0
xinput set-prop $touch_id $touch_prop_id 0
echo '*****************************************'
echo
echo 'Mouse'`xinput list-props $mouse_id | grep 'Device Enabled'`
echo 'Touch'`xinput list-props $touch_id | grep 'Device Enabled'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment