![如何忽略键盘上输入的特定字符?](https://linux22.com/image/1175707/%E5%A6%82%E4%BD%95%E5%BF%BD%E7%95%A5%E9%94%AE%E7%9B%98%E4%B8%8A%E8%BE%93%E5%85%A5%E7%9A%84%E7%89%B9%E5%AE%9A%E5%AD%97%E7%AC%A6%EF%BC%9F.png)
我的笔记本电脑的键盘出现故障,因此每当我按下空格键时,计算机就会获得输入,就好像我同时按下了空格键和向下翻页键一样。
我尝试使用xev
来找出要通过哪个字符键码来禁用它,xmodmap -e 'keycode NUMBER = NoSymbol'
但仍然无法正常工作。
我想要某种方法让操作系统完全忽略翻页按钮被触发的事实。
xev
KeyPress event, serial 37, synthetic NO, window 0x2e00001,
root 0x178, subw 0x0, time 16645657, (-273,111), root:(415,310),
state 0x10, keycode 117 (keysym 0xff56, Next), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x2e00001,
root 0x178, subw 0x0, time 16645658, (-273,111), root:(415,310),
state 0x10, keycode 65 (keysym 0x20, space), same_screen YES,
XLookupString gives 1 bytes: (20) " "
XmbLookupString gives 1 bytes: (20) " "
XFilterEvent returns: False
因此我尝试过sudo xmodmap -e 'keycode 117 = NoSymbol'
,而且以前sudo xmodmap -e 'keycode 117 = 0x0000'
如果我这样做,我可以让 xev 输出更改为以下内容:
xev
KeyPress event, serial 37, synthetic NO, window 0x2e00001,
root 0x178, subw 0x0, time 16645657, (-273,111), root:(415,310),
state 0x10, keycode 117 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x2e00001,
root 0x178, subw 0x0, time 16645658, (-273,111), root:(415,310),
state 0x10, keycode 65 (keysym 0x20, space), same_screen YES,
XLookupString gives 1 bytes: (20) " "
XmbLookupString gives 1 bytes: (20) " "
XFilterEvent returns: False
但笔记本电脑似乎仍像以前一样运行,并且仍会触发向下翻页按钮。我使用的是搭载 Ubuntu 18.04 的联想 Thinkpad T560