Skip to content

Instantly share code, notes, and snippets.

@if1live
Created October 5, 2017 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save if1live/cda67c8d154323b52102a5b28e7c7c32 to your computer and use it in GitHub Desktop.
Save if1live/cda67c8d154323b52102a5b28e7c7c32 to your computer and use it in GitHub Desktop.
Enable/Disable/Toggle Touchpad (For Acer R11 Chromebook)
#!/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