Created
April 3, 2016 07:11
-
-
Save kittinan/43df9e5ed3afd8f616df22dddea8a0e7 to your computer and use it in GitHub Desktop.
toggle touch pad ubuntu (http://ubuntuforums.org/showthread.php?t=2141992)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get the device id of the Synaptics TouchPad | |
| id=12 | |
| # Get the current state of the Device Enabled property | |
| # The devString will look like: "Device Enabled (132): 0" | |
| devString=$(xinput --list-props $id | grep "Device Enabled") | |
| # Parse the devString into an array | |
| read -a devString_array <<< "$devString" | |
| # Save the current state of the Device Enabled property | |
| # from the 4th element of devString_array | |
| devEnabled=${devString_array[3]} | |
| # Flip the state of the Device Enabled property | |
| if [ $devEnabled -eq 1 ]; then | |
| devEnabled=0 | |
| else | |
| devEnabled=1 | |
| fi | |
| # Set the "Device Enabled" property with the new value | |
| xinput set-prop $id "Device Enabled" $devEnabled | |
| # Push out a desktop notification of the new value | |
| notify-send --icon computer "Synaptics TouchPad" "Device Enabled = $devEnabled" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment