#!/bin/bash
_get_xinput_id() {
echo $(xinput | grep "$1" | sed -n 's/^.*id=\([0-9]*\)\s*.*$/\1/p')
}
TOUCHPAD=$(_get_xinput_id "Touchpad")
TOUCHPAD_MASTER=$(_get_xinput_id "Virtual core pointer")
KEYBOARD=$(_get_xinput_id "AT Translated")
KEYBOARD_MASTER=$(_get_xinput_id "Virtual core keyboard")
case "$1" in
on)
xinput float $TOUCHPAD
xinput float $KEYBOARD
;;
off)
xinput reattach $TOUCHPAD $TOUCHPAD_MASTER
xinput reattach $KEYBOARD $KEYBOARD_MASTER
;;
*)
cat <<-EOF
Usage: $0 on/off
EOF
esac
Comments