0

Is there a way to configure the caps lock button so it's not toggling? That is, so that it only applies the caps lock state while held down, and when released everything reverts to normal.

The backstory:

I am retrofitting a 1981 industrial keyboard as a USB device. It's working fine --- in fact, I'm typing on it right now.

KEYBOARD

However, the caps lock key (labelled ALPHA LOCK in the picture) is a hardware latching switch, so that if I press it once, and makes the contact and only breaks it when I press it again. From the perspective of the computer, it's another shift key.

However, I haven't found a way to set up X to support this. Caps Lock always appears to be handled via a software toggle. Combined with the hardware toggle this means I have to press the button twice to switch Caps Lock on and off, whic isn't ideal. Ideally there'd be a Caps Shift modifier that I could use, but I can't find one in xmodmap, and I'm not up to speed on xkb.

Does anyone know of any setting (however hidden) which might help here? I could just map it to another shift key, but that does't really produce the right effect.

2

Edit the file (as sudo)

/usr/share/X11/xkb/compat/basic

and change

interpret Any+Lock {
  action= LockMods(modifiers=Lock);
};

to

interpret Any+Lock {
  action= SetMods(modifiers=Lock);
};

Then log out and back in. I'm pretty sure that should do the trick. Just be aware that this will change the function of every Caps Lock key on every keyboard attached to your system. It's possible to limit this to a specific device, but that's a little beyond the scope of this question and will require you to become quite a bit more familiar with xkb configuration files.

2
  • (Very belatedly) Thanks! That was exactly what I was looking for. – David Given Nov 18 '17 at 17:02
  • Also, is this stuff documented anywhere? I haven't found anything... – David Given Nov 18 '17 at 17: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.