Skip to content

Instantly share code, notes, and snippets.

@samundra
Last active June 13, 2016 14:45
Show Gist options
  • Select an option

  • Save samundra/6e06485c46f8267b222b1d4f7d6ea85b to your computer and use it in GitHub Desktop.

Select an option

Save samundra/6e06485c46f8267b222b1d4f7d6ea85b to your computer and use it in GitHub Desktop.
Touchpad scripts
#!/bin/bash
#filename: /usr/local/bin/touchpad.sh
declare -i ID
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
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."
notify-send 'Touchpad' 'Disabled' -i /usr/share/icons/hicolor/64/apps/touchpad.png -t 2000
else
xinput enable $ID
echo "Touchpad enabled."
notify-send 'Touchpad' 'Enabled' -i /usr/share/icons/hicolor/64/apps/touchpad.png -t 2000
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment