Skip to content

Instantly share code, notes, and snippets.

@onjin
Created November 14, 2016 15:19
Show Gist options
  • Save onjin/cff60f383fabb7f5e8bf04b744ad985f to your computer and use it in GitHub Desktop.
Save onjin/cff60f383fabb7f5e8bf04b744ad985f to your computer and use it in GitHub Desktop.
#!/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