Created
November 14, 2016 15:19
-
-
Save onjin/cff60f383fabb7f5e8bf04b744ad985f to your computer and use it in GitHub Desktop.
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 | |
ID=$(xinput list|grep TouchPad|awk '{print $6}'| cut -d= -f 2) | |
STATE=$(xinput list-props ${ID} |grep 'Device Enabled'| awk '{ print $4}') | |
function do_enable() { | |
xinput enable ${ID} | |
killall notify-osd | |
notify-send 'TouchPad enabled' | |
} | |
function do_disable() { | |
xinput disable ${ID} | |
killall notify-osd | |
notify-send 'TouchPad disabled' | |
} | |
case "$1" in | |
on) | |
do_enable | |
;; | |
off) | |
do_disable | |
;; | |
*) | |
if [ ${STATE} == 0 ]; then | |
do_enable | |
else | |
do_disable | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment