# disable
xinput list | grep AT | egrep -o "id=[0-9]*" | egrep -o "[0-9]*" | xargs xinput disable
# enable
xinput list | grep AT | egrep -o "id=[0-9]*" | egrep -o "[0-9]*" | xargs xinput enable
- 原理:
使用xinput list
获取本机自带键盘的 id:
使用xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ 2.4G Mouse id=8 [slave pointer (2)] ⎜ ↳ DELL09EC:00 27C6:01E0 Mouse id=10 [slave pointer (2)] ⎜ ↳ DELL09EC:00 27C6:01E0 Touchpad id=11 [slave pointer (2)] ⎜ ↳ PS/2 Generic Mouse id=16 [slave pointer (2)] ⎜ ↳ HID 026d:0002 Consumer Control id=18 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Video Bus id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Integrated_Webcam_HD: Integrate id=9 [slave keyboard (3)] ↳ Intel HID events id=12 [slave keyboard (3)] ↳ Intel HID 5 button array id=13 [slave keyboard (3)] ↳ Dell WMI hotkeys id=14 [slave keyboard (3)] ↳ HID 026d:0002 Keyboard id=17 [slave keyboard (3)] ↳ HID 026d:0002 Consumer Control id=19 [slave keyboard (3)] ↳ HID 026d:0002 id=20 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=15 [slave keyboard (3)]
grep
、egrep
获取对应的 ID,然后禁用