I want to swap Capslock with Backspace and came only so far as to mix them both together. By that I mean: hitting Capslock does work like the Backspace key, but also activates Caps (including the LED).

When I was using Gnome, the Keyboard Settings would let me easily do the switch. In XFCE these options are missing, so I tried via .Xmodmap and xkeycaps. Xkeycaps even lets me export the stuff to .Xmodmap, but somehow it does not work. I'm missing something here!

Current .Xmodmap (commented out because it gives errors "bad keysym in remove modifier list 'Caps_Lock', no corresponding keycodes", this was mostly described in forums)

keycode  66 = BackSpace
! remove Lock    = Caps_Lock
remove Mod5    = Mode_switch Mode_switch

Referencing xmodmap to load in .profile etc did not work either. I could live with installing the Gnome-Keyboard Settings tool on my xfce system, if nothing else helps - which package is it?

EDIT: setxkbmap -option caps:backspace works, BUT: key does not repeat on holding down UNLESS i use xmodmap -e "clear Lock" as well. Not quite elegant, but apparently working.

  • I just found out about setxkbmap and the option "caps:backspace", which seems to be what gnome does via GUI
    – marto
    Nov 3, 2011 at 7:31
  • setxkbmap -option caps:backspace works, BUT: key does not repeat on holding down
    – marto
    Nov 3, 2011 at 7:52
  • yep, thx for the hint
    – marto
    Nov 25, 2011 at 22:01

3 Answers 3


To close this one, I'll add my current fix. Maybe someone can use it too. Put this in a script, autostart it with DE:

setxkbmap -option caps:backspace
setxkbmap -option shift:both_capslock
xmodmap -e "clear Lock"
  • 3
    For ubuntu, see askubuntu.com/a/432966/12648, no xmodmap or autostart needed, just options 'caps:backspace','shift:both_capslock' in dconf-editor org >> gnome >> desktop >> input-sources >> xkb-options list.
    – bonger
    Aug 13, 2015 at 10:28
  • 1
    @bonger the dconf-editor doesn't work with key repeat though (Ubuntu 14.04)
    – A.Wan
    Nov 1, 2015 at 3:14
  • The answer @bonger gave worked for me. Note that you have t oplace in the custom values the text ['caps:backspace', 'shift:both_capslock'] don't forget the brackets. Jun 24, 2021 at 7:46

You can actually make some changes to your keys exchange. Click on power icon, on the extreme top right hand corner of your screen. Select 'System Settings' and double-click on 'Keyboard Layout'. Locate 'Option' at the popup box and click on it. Look for 'CAPS Lock Key Behavior' and click on the arrow before that option, from the drop-down menu select 'Make Caps lock additional Backspace'. I hope that answers your question. Thank you.

  • I'm on XFCE, as I described there is no such such option like in gnome also edited tags for better visibility
    – marto
    Nov 3, 2011 at 7:06
  • I don't understand why it doesn't work for you. FYI, I am not using gnome either but it worked for me.
    – all4naija
    Nov 25, 2011 at 0:02

When I swap keys in .xmodmap I always give two commands like this:

keycode key1 = function key2

keycode key2 = function key1

  • yes, but somehow it does not always work. Or it works partly. Ghost in the machine..
    – marto
    Nov 3, 2011 at 7:29
  • then I'm sorry, never had any problems with that. thought so because in your .xmodmap you only have one keycode command.
    – joschi
    Nov 3, 2011 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.