Remapping Caps Lock to Backspace in i3/sway (Colemak, Etc)
Author: Jonathan Vasquez <jon@xyinn.org>
Last Updated: 2025-09-15-1900
Running: FreeBSD 14.3-STABLE stable/14-n272412-9c390bd8829c GENERIC amd64
pub fn main() !void
If you are using the Colemak Keyboard Layout, or
you just want to remap your [Caps Lock]
to [Backspace]
to reduce
hand travel, you can do so by adding the following to ~/.xinitrc
(or
wherever it works for you):
setxkbmap -option caps:backspace
xset r 66
The first command command will make the Caps key become an additional backspace,
and the second command will enable autorepeat on Key 66, which will allow repeated
deletions when you press and hold the Caps key. This will execute when you start
Xorg via startx
.
If you are using sway/Wayland, the following will allow you to switch between
QWERTY
and Colemak
using a [Left Ctrl] + [Space]
combo, and also makes
the [Caps Lock]
a [Backspace]
for both layouts. You can do
man 7 xkeyboard-config
to see a list of layouts and other key combinations
you can use with these options:
~/.config/sway/config
:
# Keyboard (QWERTY, Colemak)
input type:keyboard {
xkb_layout us,us(colemak)
xkb_options grp:ctrl_space_toggle,caps:backspace
}
I'm doing these instructions on FreeBSD 14.3 and it's working smoothly with i3 and sway. These should also work on Linux as well.