I have an X11 program that grabs caps-lock, and uses it. The problem is, I want to disable the regular caps-lock toggling, but doing so seems to disable the key.

So whatever X11 gets for a caps-lock keypress, it must still get (no disabling the key, or remapping it to some other key), but without anything translating the keypress into a caps-toggle (which might be at the kernel level?).

I tried changing the scancode, but this just remapped the key. I've removed the capslock entry with xmodmap too, but this also disabled caps.

How can I tell the kernel to ignore the caps-key (wrt its regular functionality), but still pass along the message to X?

Just to add a bit more detail:

The 'program' I'm trying to run is humanised 'enso'. When there is no key I get the error "CRITICAL:root:Couldn't find quasimode key". When there is no error, I can use enso with caps, but sofar haven't figured out how to disable caps functionality while enso is still able to get at it.

  • Please provide details as to what you tried, i.e. the exact xmodmap expressions. Without details we can't tell whether you knew what to do and did it wrong, or whether you did it right but the code failed for some other reason. Also give us the OS you're using because some have keycode processing that occurs below the X server level. – Kyle Jones May 12 '13 at 0:37
  • @Kyle I tried "remove Lock = Caps_Lock", and then " keycode 66 =" (which was mapped to CapsLock). I'm running ubuntu 12.10 on a 64bit machine. – Chris2048 May 12 '13 at 2:36
  • Another possibility is to remap to another key. setxkbmap -option ctrl:nocaps remaps to Control_L, for example. – Chris Down May 12 '13 at 4:42
  • Are saying you'd be OK if we could give you a way to remap the caps-lock to say the control key or is that not what you're after? As it stands this question is kind of confusing, it would really go a long way if you added specifics into the question of what you've tried so far. – slm May 12 '13 at 5:01
  • Just so we're clear too, there is a feature in Ubuntu 12.10 where you can make caps-lock an additional control key. Is this what you're thinking when you say "remapping"? Here's a screenshot of the dialog: flickr.com/photos/11708996@N00/3010939023 – slm May 12 '13 at 5:05

I think I have a technique for disabling the toggling of the Capslock key but not completely disabling the key all together, or remapping it to another key on the keyboard.

If you use the command:

setxkbmap -option caps:none

The keyboard will no longer toggle. I've confirmed this on my laptop running Fedora 14, the LED no longer lights up, and normal Capslock functionality is gone.

However using xev still shows that the key is being pressed:

$ xev
KeyPress event, serial 35, synthetic NO, window 0x6800001,
    root 0xb1, subw 0x0, time 261504852, (167,-15), root:(353,268),
    state 0x10, keycode 66 (keysym 0xffffff, VoidSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x6800001,
    root 0xb1, subw 0x0, time 261504971, (167,-15), root:(353,268),
    state 0x10, keycode 66 (keysym 0xffffff, VoidSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

So the key being pressed events are still left intact for other applications to pick them up.


The file /usr/share/X11/xkb/rules/xorg.lst contains the complete list of what options you can give to setxkbmap.

Grepping through this file for "cap" I noticed this line:

caps:none            CapsLock is disabled

There are other values in this file so if this isn't what you're after perhaps one of those alternate values would suite instead.

$ grep cap /usr/share/X11/xkb/rules/xorg.lst
  grp:caps_switch      CapsLock (while pressed), Alt+CapsLock does the original capslock action
  grp:caps_toggle      CapsLock
  grp:shift_caps_toggle Shift+CapsLock
  grp:shift_caps_switch CapsLock (to first layout), Shift+CapsLock (to last layout)
  grp:alt_caps_toggle  Alt+CapsLock
  lv3:caps_switch      CapsLock
  lv3:caps_switch_latch CapsLock (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)
  ctrl:nocaps          Make CapsLock an additional Ctrl
  ctrl:swapcaps        Swap Ctrl and CapsLock
  grp_led:caps         CapsLock
  caps                 CapsLock key behavior
  caps:internal        CapsLock uses internal capitalization. Shift "pauses" CapsLock
  caps:internal_nocancel CapsLock uses internal capitalization. Shift doesn't affect CapsLock
  caps:shift           CapsLock acts as Shift with locking. Shift "pauses" CapsLock
  caps:shift_nocancel  CapsLock acts as Shift with locking. Shift doesn't affect CapsLock
  caps:capslock        CapsLock toggles normal capitalization of alphabetic characters
  caps:numlock         Make CapsLock an additional NumLock
  caps:swapescape      Swap ESC and CapsLock
  caps:escape          Make CapsLock an additional ESC
  caps:backspace       Make CapsLock an additional Backspace
  caps:super           Make CapsLock an additional Super
  caps:hyper           Make CapsLock an additional Hyper
  caps:shiftlock       CapsLock toggles Shift so all keys are affected
  caps:none            CapsLock is disabled
  compose:caps         CapsLock
  shift:breaks_caps    Shift cancels CapsLock
  shift:both_capslock  Both Shift-Keys together toggle CapsLock
  shift:both_capslock_cancel Both Shift-Keys together activate CapsLock, one Shift-Key deactivates


  • 6
    If you accidentally run the command with your capslock on, you can reset xkbmap by running setxkbmap -option "". – Nemo Aug 15 '14 at 18:29
  • It shows up in xev, but doesn't really work in the Valve Source 2 engine. – Velkan Dec 17 '18 at 19:20
  • 2
    @Nemo I love you, I keep running this by mistake because I have a hotkey for when I connect an external keyboard, and you saved me from having to reboot every time. – Stavros Korokithakis Jan 7 '20 at 18:20

If you don't want the Caps Lock key to have its usual effect, you can turn off the Lock modifier, while retaining the Caps_Lock keysym.

xmodmap -e 'clear Lock'
  • That doesn't seem to disable capslock. – Chris2048 May 13 '13 at 20:31
  • @Chris2048 Works For Me™. It may be incompatible with some XKB settings, or with some applications (applications do their own caps lock processing, most of them use the same library functions but there are exceptions). – Gilles 'SO- stop being evil' May 13 '13 at 21:06

This is very similar to the answer I gave for another question. This snippet of xkb code should do the trick.

partial modifier_keys
xkb_symbols "capsoff" {
    key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ Caps_Lock ],
        actions[Group1] = [ NoAction() ]
  • where should this go ? I've been looking at this kind of snippets for 10 minutes without figuring it out. Does it have to be part of a more complete file or can it stand alone and apply to the default config ? – Nikana Reklawyks Jan 26 '17 at 9:47

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.