Skip to content

Instantly share code, notes, and snippets.

@alexandervantrijffel
Created January 21, 2018 19:27
Show Gist options
  • Save alexandervantrijffel/ee665e54ed877800caaa97db59fc1b79 to your computer and use it in GitHub Desktop.
Save alexandervantrijffel/ee665e54ed877800caaa97db59fc1b79 to your computer and use it in GitHub Desktop.
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'Generic Mouse\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
echo id is $ID
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
echo "Touchpad disabled."
else
xinput enable $ID
echo "Touchpad enabled."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment