我希望将 Control 与 Caps Lock 交换,但在文本控制台中(不是 X11/Wayland 上的终端模拟器)。我浏览了加载键和键盘映射的手册页。经过几次尝试后,我做到了,但并不完全理解解决方案。
我使用加载键如下:
sudo loadkeys <filename>
其中内容是:
keycode 58 = Control
keycode 29 = Caps_Lock
然后我用 dumpkeys 检查了结果,显示:
keycode 58 = Control CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock CtrlL_Lock
keycode 29 = Caps_Lock Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control Control
这不是我期望得到的结果,导致按下 CapsLock 后键盘无法使用。
然后我添加了键位图正如键盘映射手册建议的那样。然后地图文件如下所示:
keymaps 0-6,8-9,12
keycode 58 = Control
keycode 29 = Caps_Lock
和 dumpkeys 显示:
keycode 29 = Caps_Lock
keycode 58 = Control
现在它按我想要的方式工作了。现在的问题是:
- 为什么在第一种情况下,第一列已填充了我的地图文件中的值,但其余 256 列却得到了一些值?为什么 58 为“CtrlL_Lock”,29 为何为“Control”?
- 在第二种情况下,仅填充第一个值,其余为空白键位图实际上定义了多个列?