Created
October 5, 2017 09:33
-
-
Save if1live/cda67c8d154323b52102a5b28e7c7c32 to your computer and use it in GitHub Desktop.
Enable/Disable/Toggle Touchpad (For Acer R11 Chromebook)
This file contains 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 | |
LOG_FILE=/tmp/touchpad-enable-log | |
XINPUT_ID=`xinput list|grep Touchpad|awk '{print $5}'|cut --delimiter="=" -f 2` | |
function enable_touchpad() { | |
#/usr/bin/synclient TouchpadOff=0 | |
xinput --enable $XINPUT_ID | |
echo "touchpad_enable\t:`date`" >> $LOG_FILE | |
} | |
function disable_touchpad() { | |
#/usr/bin/synclient TouchpadOff=1 | |
xinput --disable $XINPUT_ID | |
echo "touchpad_disable\t:`date`" >> $LOG_FILE | |
} | |
function toggle_touchpad() { | |
enabled=`xinput list-props $XINPUT_ID|grep Enabled|awk {'print $4'}` | |
if [[ $enabled == "1" ]]; then | |
disable_touchpad | |
else | |
enable_touchpad | |
fi | |
} | |
if [[ $1 == "1" ]]; then | |
enable_touchpad | |
elif [[ $1 == "0" ]]; then | |
disable_touchpad | |
else | |
toggle_touchpad | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment