Swapping Caps Lock via SSH on GNOME | Generated by AI
On Fedora 44 (GNOME/Wayland), I ran this over SSH:
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:swapcaps']"
How it works:
-
DBUS_SESSION_BUS_ADDRESS— SSH sessions don’t have access to the GNOME desktop bus. Setting this env var points to the running user’s D-Bus socket so gsettings can talk to the GNOME session. -
gsettings set org.gnome.desktop.input-sources xkb-options— GNOME’s keyboard settings stored in dconf. Thexkb-optionskey accepts a list of XKB options. -
ctrl:swapcaps— XKB option fromxkeyboard-configthat swaps the Caps Lock and Left Ctrl keycodes at the input layer. Works on both Wayland and X11.
Persists across reboots because it’s stored in GNOME’s dconf database (~/.config/dconf/user).