~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Toggling X Input

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

On X, we can easily enable or disable input devices using the xinput command. This is a great use case when you’re tired of accidentally hitting the red Thinkpad nub or having your palm be recognized when drawing with a pen.

Running the xinput command performs the action temporarily. Your default settings will be restored upon a reboot.

To list xinput devices run:

xinput

To disable a device:

xinput disable [id]

To enable a device:

xinput enable [id]

The ids are listed when you list the devices.

To query whether the device is enabled or disabled:

xinput --list-props [id] | grep "Device Enabled" | awk '{ print $NF }'

This will return $1$ or $0$ depending on if its enabled or not respectively.

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :