想要禁用笔记本自带键盘(Ubuntu)只要2条命令。
1. 打开终端,输入:
xinput list
? Virtual core pointer id=2 [master pointer (3)]
? ? Virtual core XTEST pointer id=4 [slave pointer (2)]
? ? HID Keyboard Device id=12 [slave pointer (2)]
? ? G-Tech Wireless Dongle id=14 [slave pointer (2)]
? ? ETPS/2 Elantech Touchpad id=16 [slave pointer (2)]
? Virtual core keyboard id=3 [master keyboard (2)]
? Virtual core XTEST keyboard id=5 [slave keyboard (3)]
? Power Button id=6 [slave keyboard (3)]
? Video Bus id=7 [slave keyboard (3)]
? Video Bus id=8 [slave keyboard (3)]
? Power Button id=9 [slave keyboard (3)]
? Sleep Button id=10 [slave keyboard (3)]
? HID Keyboard Device id=11 [slave keyboard (3)]
? G-Tech Wireless Dongle id=13 [slave keyboard (3)]
? AT Translated Set 2 keyboard id=15 [slave keyboard (3)]
? MSI WMI hotkeys id=17 [slave keyboard (3)]
拔掉外接键盘,用排除法找到笔记本自带键盘。我的笔记本键盘是id为15的AT Translated Set 2 keyboard。
2. 输入:
xinput set-prop 15 "Device Enabled" 0
代码中的15指的是我的笔记本键盘的id,请自行根据自己想要禁用的装置的id替换。