如何切换xinput设备道具

我可以禁用这样的设备:

xinput set-prop 13 "Device Enabled" 0 

但我想实际设置一个自定义快捷方式,在0 \ 1之间切换。 我的bash技能有点生疏,所以我该怎么做? 没有get-prop命令,我得到了这个:

 xinput list-props 13 | grep "Device Enabled" 

哪个正确打印出来

 Device Enabled (135): 1 

但我不知道接下来该做什么。 救命?

使用以下bash脚本打开或关闭xinput设备。

 #!/bin/bash device=13 state=$(xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$") if [ $state == '1' ];then xinput --disable "$device" else xinput --enable "$device" fi