There seem to be several options for setxkbmap
such as -option caps:backspace
which makes caps a backspace. However I cannot seem to find an option that makes backspace an escape key. How do I create a single setxkbmap command that changes the backspace key to an escape key?
Keyboard Shortcuts – Make Backspace Act as Escape Using Setxkbmap
keyboard shortcutsxkb
Best Answer
You'll have to define a new option.
First, make a new symbol file e.g.
/usr/share/X11/xkb/symbols/bksp
with the following content:Then create the new option like this:
(where
bksp
is the name of the symbol file andbksp_escape
is the group name that was defined in this file) and add it to the options list in the rules set you're using - assumingevdev
- so place it in/usr/share/X11/xkb/rules/evdev
under! option = symbols
:Add it also to
/usr/share/X11/xkb/rules/evdev.lst
(with a short description) under! option
(e.g. right beforectrl
):You can then run, as a regular user:
to enable the option and make BKSP behave as ESC.
You can also verify if:
reports:
and if
outputs:
In Gnome 3 you can make the option permanent via
dconf
(orgsettings
in terminal) e.g. add'bksp:bksp_escape'
to the org>gnome>desktop>input-sources>xkb-options key (note that indconf
values are separated by comma+space).Finally, note that both
evdev
andevdev.lst
will be overwritten on future upgrades (but not your custombksp
symbol file) so you'll have to edit them again each time the package that owns them is upgraded (on archlinux it'sxkeyboard-config
). It's easier to write a script that does that, e.g.If you're happy with the result use
sed -i
(or-i.bak
if you want to make backup copies) to actually edit those files in-place.