我无法将 Wayland (gnome) 中的 Capslock 键重新映射为 Escape。我尝试过 Gnome Tweaks 和
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"
两者都不会导致 Capslock 键发出 Escape 键按下信号。我可以在 Xorg 上执行此操作,但在 Wayland 上不起作用。
答案1
您可以使用dconf:
$ dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:swapescape']"
答案2
gsettings
为我工作(debian bullseye、gnome + wayland)。也许您需要以不同的方式转义该值?
gsettings set org.gnome.desktop.input-sources xkb-options \[\'caps:escape\'\]
但这些设置没有很好的记录。作为一个具有 gsettings 的 n00b,我天真地希望range
能够显示xkb-options
.
---------- me@my-desktop:~ ----------
$ gsettings range org.gnome.desktop.input-sources xkb-options
type as <-- not informative
---------- me@my-desktop:~ ----------
$ gsettings describe org.gnome.desktop.input-sources xkb-options
List of XKB options. Each option is an XKB option string as defined by xkeyboard-config’s rules files.
宝贵的线索!
---------- me@my-desktop:~ ----------
$ more /usr/share/X11/xkb/rules/evdev.lst | grep caps:
caps:internal Caps Lock uses internal capitalization; Shift "pauses" Caps Lock
caps:internal_nocancel Caps Lock uses internal capitalization; Shift does not affect Caps Lock
caps:shift Caps Lock acts as Shift with locking; Shift "pauses" Caps Lock
caps:shift_nocancel Caps Lock acts as Shift with locking; Shift does not affect Caps Lock
caps:capslock Caps Lock toggles normal capitalization of alphabetic characters
caps:shiftlock Caps Lock toggles ShiftLock (affects all keys)
caps:swapescape Swap ESC and Caps Lock
caps:escape Make Caps Lock an additional Esc
caps:escape_shifted_capslock Make unmodified Caps Lock an additional Esc, but Shift + Caps Lock behaves like regular Caps Lock
caps:backspace Make Caps Lock an additional Backspace
caps:super Make Caps Lock an additional Super
caps:hyper Make Caps Lock an additional Hyper
caps:menu Make Caps Lock an additional Menu key
caps:numlock Make Caps Lock an additional Num Lock
caps:ctrl_modifier Caps Lock is also a Ctrl
caps:none Caps Lock is disabled