#!/bin/bash # Gets the device id and current state of the Trackpad and toggles it on or off. # Can be used with any other input device though. # Put a pattern in here that uniquely identifies your trackpad. # Run "xinput --list" for a list of input devices. pattern="FingerSensingPad" mouse_id=$(xinput --list | sed -n "s/.*"$pattern".*id=\([0-9]*\).*/\1/p") state=$(xinput list-props $mouse_id | sed -nr 's/Device Enabled \(134\)://p') if [ $state -eq 0 ]; then xinput enable $mouse_id thor-cli --no-image --no-bar -m"Trackpad enabled" else xinput disable $mouse_id thor-cli --no-image --no-bar -m"Trackpad disabled" fi