如何禁用笔记本电脑上的向上和向下箭头键

如何禁用笔记本电脑上的向上和向下箭头键

我正在使用 Ubuntu 18.04。

xev -event我在终端上运行了代码键盘,然后输入了代码xmodmap -e 'keycode 113=';但我的向上箭头键并没有像我预期的那样被禁用。

我对另一个键(向下箭头键)重复了相同的步骤,但这次我将 113 改为 116,希望禁用向下箭头键,但它并没有被禁用。

在此处输入图片描述

答案1

例子:

xev -event keyboard

上述命令输出中的一行表示向上箭头键
state 0x10, keycode 111 (keysym 0xff52, Up), same_screen YES,

上述命令输出中的一行表示向下箭头键
state 0x10, keycode 116 (keysym 0xff54, Down), same_screen YES,

运行以下命令

$ xmodmap -e "keycode 111 = "
$ xmodmap -e "keycode 116 = "
$ 

使用以下命令检查

$ xmodmap -pke | grep Up
keycode  80 = KP_Up KP_8 KP_Up KP_8 KP_Up KP_8
keycode 151 = XF86WakeUp NoSymbol XF86WakeUp NoSymbol XF86WakeUp
keycode 185 = XF86ScrollUp NoSymbol XF86ScrollUp NoSymbol XF86ScrollUp
keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp
keycode 238 = XF86KbdBrightnessUp NoSymbol XF86KbdBrightnessUp NoSymbol XF86KbdBrightnessUp
$ xmodmap -pke | grep Down
keycode  88 = KP_Down KP_2 KP_Down KP_2 KP_Down KP_2
keycode 186 = XF86ScrollDown NoSymbol XF86ScrollDown NoSymbol XF86ScrollDown
keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
keycode 237 = XF86KbdBrightnessDown NoSymbol XF86KbdBrightnessDown NoSymbol XF86KbdBrightnessDown
$ 

xev -event keyboard结果

KeyRelease event, serial 28, synthetic NO, window 0x3000001,
    root 0x105, subw 0x0, time 396765, (1224,931), root:(1274,1011),
    state 0x10, keycode 111 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x3000001,
    root 0x105, subw 0x0, time 397693, (1224,931), root:(1274,1011),
    state 0x10, keycode 116 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

相关内容