我目前已经通过这些命令Caps Lock映射到Ctrl何时持有和何时点击(对于 vim)Esc.xinitrc
setxkbmap -option 'caps:ctrl_modifier'
xcape -e 'Caps_Lock=Escape'
这可行,但我没有,Caps Lock所以我想重新映射Esc到Caps Lock.我尝试过设置它,xmodmap -e 'keycode 9 = Caps_Lock'
但这也会覆盖按键上的映射Caps Lock。有什么办法可以实现这些映射吗?
Caps Lock -> Ctrl and Esc
Esc -> Caps Lock
答案1
您可以使用setxkbmap
或xmodmap
来交换 Caps Lock 和 Escape。和xmodmap
你一起可以:
! Remove Caps_Lock modifier from real Caps Lock key
clear Lock
! Set real Caps Lock key to present as (left) control
keycode 66 = Control_L
! Set real Escape key to present as Caps Lock
keycode 9 = Caps_Lock
! Make a fake key to hold the Escape keysym, so xcape can use it
keycode 255 = Escape
! Make Caps_Lock and Control_L work as one would expect
add Lock = Caps_Lock
add Control = Control_L
(以 开头的行!
是注释。)
将其放入~/.xmodmaprc
并运行xmodmap ~/.xmodmaprc
,然后运行xcape -e '#66=Escape'
以将 Escape 功能添加到真正的 Caps Lock 键。