Skip to content

Instantly share code, notes, and snippets.

@dokker
Created January 15, 2016 09:18
Show Gist options
  • Save dokker/e5baa766e7066d782cb9 to your computer and use it in GitHub Desktop.
Save dokker/e5baa766e7066d782cb9 to your computer and use it in GitHub Desktop.
PS/2 Touchpad toggle
#!/bin/bash
# https://wiki.archlinux.org/index.php/Touchpad_Synaptics#Software_toggle
declare -i ID
ID=`xinput list | grep -Eio 'touchpad\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/Adwaita/48x48/devices/input-touchpad.png
else
xinput enable $ID
# echo "Touchpad enabled."
# notify-send 'Touchpad' 'Enabled' -i /usr/share/icons/Adwaita/48x48/devices/input-touchpad.png
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment