终端执行 xinput 查看设备

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ SIGMACHIP Usb Mouse                         id=10    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                  id=13    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=12    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ EasyCamera: EasyCamera                      id=11    [slave  keyboard (3)]
    ↳ Power Button                                id=9    [slave  keyboard (3)]
    ↳ Video Bus                                   id=8    [slave  keyboard (3)]

从上面可以看到AT Translated Set 2 keyboard 是我的键盘.

所以执行下面这条命令就可以禁用它.

xinput set-prop 'AT Translated Set 2 keyboard' "Device Enabled" 0

如果需要启用,可以执行

xinput set-prop 'AT Translated Set 2 keyboard' "Device Enabled" 0

或者注销再次登录

如果需要重启后仍然生效,需要使用systemd.