serhii.net

In the middle of the desert you can say anything you want

13 Jun 2022

Linux toggle touchpad

Toggle touchpad (enable/disable) in Linux with xinput.:

if xinput list-props 13 | grep "Device Enabled ([[:digit:]]\+):\s*1" >/dev/null; then xinput disable 13 && notify-send -u low -i mouse "Trackpad disabled"; else xinput enable 13 && notify-send -u low -i mouse "Trackpad enabled"; fi

With 13 being the xinput id of the touchpad.

My old enable/disable oneliners have bits on how to find the ID:

'bash -c "xinput | grep TouchPad | ag -o "[0-9][0-9]"  | xargs xinput disable"'

That said, I don’t remember the ID ever being anything else than 13.

Nel mezzo del deserto posso dire tutto quello che voglio.