Linux下用大写锁定和HJKL模拟方向键

Keyboard

xorg

映射大写锁定+HJKL
创建文件~/.xmodmap,内部写入如下内容:

    keycode 66 = Mode_switch
    keysym h = h H Left
    keysym l = l L Right
    keysym k = k K Up
    keysym j = j J Down
    keysym semicolon = semicolon colon Home
    keysym apostrophe = apostrophe quotedbl End

如果要配置别的按键,可以用 xev 命令获取键位名称,例如最后两行,我把分号和引号映射成了HOME和END。
然后执行 xmodmap ~/.xmodmap即可。

wayland

使用evremap工具实现,配置如下:

device_name = "ROYUAN Dukharo VN66 Wired"

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_H"]
output = ["KEY_LEFT"]

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_J"]
output = ["KEY_DOWN"]

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_K"]
output = ["KEY_UP"]

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_L"]
output = ["KEY_RIGHT"]

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_SEMICOLON"]
output = ["KEY_HOME"]

[[remap]]
input = ["KEY_LEFTCTRL", "KEY_APOSTROPHE"]
output = ["KEY_END"]

Comment