chr*_*ris 16 openbox emacs xmodmap
我有一个 Apple 键盘,在使用 Emacs 时,我必须对键进行一些重新映射,以使该mod-4
键成为Space栏左侧的第一个键。当我使用 dwm 窗口管理器时,下面的脚本运行良好,但是在切换到 Openbox 后,我发现不是在选项键和命令键之间交换键码,而是两个键都在做同样的事情。
我注意到的一件奇怪的事情是,当我单击运行showkey
并按下选项和命令键时,我分别得到 56 和 125的新设置,但是将它们插入下面的脚本而不是 64 和133.
我必须承认,我通过不断调整它直到它起作用来创建下面的脚本,因此可能有更好的方法来做到这一点。
# switch alt and command...the switch is not being done properly
xmodmap -e "keycode 64 = Alt_L"
xmodmap -e "keycode 133 = Meta_L"
# remap of mod 4
xmodmap -e "clear Mod4"
xmodmap -e "add Mod4 = Super_L"
Run Code Online (Sandbox Code Playgroud)
我习惯了以前的键盘设置并放弃了尝试调整它。不幸的是,经过近期重启CapsLock到Ctrl不再工作所以在这里我再次。
这次我没有使用上面使用的映射,而是运行xmodmap -pke > ~/.xmod
并调整那里的键(这更容易)。
然而,事情仍然不太对劲。将CapsLock仍然用作正常时除外xev
命令运行,则它返回这似乎以显示正确的映射如下:
# caplock
KeyRelease event, serial 40, synthetic NO, window 0x2200001,
root 0x156, subw 0x0, time 4858000, (57,-31), root:(426,402),
state 0x2, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XFilterEvent returns: False
# ctrl-L
KeyRelease event, serial 40, synthetic NO, window 0x2200001,
root 0x156, subw 0x0, time 4805947, (686,148), root:(1055,581),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
# Alt-L
KeyPress event, serial 40, synthetic NO, window 0x2200001,
root 0x156, subw 0x0, time 4555825, (-158,-649), root:(959,133),
state 0x0, keycode 64 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
# Super-L
KeyRelease event, serial 40, synthetic NO, window 0x2200001,
root 0x156, subw 0x0, time 4920564, (-63,169), root:(306,602),
state 0x40, keycode 133 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Run Code Online (Sandbox Code Playgroud)
您可能需要将以下内容放在您的开头~/.xmod
remove Lock = Caps_Lock
remove Control = Control_L
remove Mod1 = Alt_L Meta_L
remove Mod4 = Super_L Hyper_L
Run Code Online (Sandbox Code Playgroud)
以及底部的以下内容~/.xmod
add Control = Control_L
add Mod1 = Alt_L Meta_L
add Mod4 = Super_L Hyper_L
Run Code Online (Sandbox Code Playgroud)
这将更新系统以识别这些键的修饰符性质。