I can disable a device like this:

xinput set-prop 13 "Device Enabled" 0

But I want to actually set a custom shortcut that toggles this between 0\1. My bash skills are kinda rusty, so how can I do this? There's no get-prop command, I got this far:

xinput list-props 13 | grep "Device Enabled"

Which correctly prints out

Device Enabled (135):   1

But I don't know what to do next. Help?

| improve this question | | | | |

Toggle xinput device on or off with following bash script.


state=$(xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$")

if [ $state == '1' ];then
  xinput --disable "$device"
  xinput --enable "$device"
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.