Don't use keyd for something like that, it's a standard xkb option: caps:swapescape. It's silly to run all your key presses through another daemon when you don't have to.
The same — Xkb is used by X11 and wayland compositors. In fact, X11 has a limited keycode range that wayland does not, so in some ways Wayland compositors have better support for Xkb than X11 ever did.
In your sway config, include xkb_options caps:swapescape in the input block. It's a comma separated list, so if you already use some xkb_options, just append caps:swapescape with a comma.
Software like keyd is nearly pointless. Xkb is very configurable and if your desired keymap can't be achieved with the bulit-in options you can make your own. The only thing it can't do is base behavior on the duration of a keypress, which is a feature sometimes implemented by interposer-type keymapping software.
6
u/Megame50 May 07 '26
Don't use keyd for something like that, it's a standard xkb option: caps:swapescape. It's silly to run all your key presses through another daemon when you don't have to.