toggle-touch (782B)
1 #!/bin/sh 2 # Toggle touchpad between enabled and disabled. 3 TOUCHPAD_ID="$(xinput list | grep -Eo '(Touchpad|Synaptics).*id=[0-9]*' | sed -e "s|.*id=||")" 4 TOUCHPAD_MODE="$(echo "$TOUCHPAD_ID" | xargs -I % xinput --list-props % | grep "Device Enabled.*:.*[0|1]" | sed -e 's|.*: *||')" 5 6 if [ "$TOUCHPAD_MODE" -eq "1" ]; then 7 xinput set-prop "$TOUCHPAD_ID" "Device Enabled" 0 8 echo "Device disabled." 9 dunstify -h string:x-dunst-stack-tag:touchpad-toggle -t 700 \ 10 -i "touchpad-disabled-symbolic" "Touchpad" "Touchpad has been disabled" 11 else 12 xinput set-prop "$TOUCHPAD_ID" "Device Enabled" 1 13 echo "Device enabled." 14 dunstify -h string:x-dunst-stack-tag:touchpad-toggle -t 700 \ 15 -i "touchpad-enabled-symbolic" "Touchpad" "Touchpad has been enabled" 16 fi