trackpad (449B)
1 #!/bin/sh 2 3 # (de)activate/toggle trackpad 4 5 tp=$(xinput list | sed -n '/Touchpad/{ 6 s:.*↳ \(.*\)id=.*:\1:; 7 s:∼ \(.*\)id=.*:\1:; 8 s:[[:space:]]*$::p 9 }' | head -1) || exit 0 10 enabled=$(xinput list-props "$tp" | awk '/Device Enabled/{print $4}') 11 12 [ $# -eq 1 ] || set err 13 case $1 in 14 enable) ;; 15 disable) ;; 16 toggle) [ "$enabled" = "1" ] && set disable || set enable ;; 17 *) echo "usage: trackpad enable|disable|toggle"; exit 1 ;; 18 esac 19 20 xinput "$1" "$tp"