Caps lock turns on/off only on release

Title says it all. For some reason capslock isn’t activating/deactivating on press, and what happens is I always ENd UP WIth THe TWo FIrst LEtters IN CAps BEcause OF THe WAy I TYpe.

Is your shift key broken?

2 Likes

Do you have access to another keyboard to rule out a hardware issue?

2 Likes

No, I’m a new user coming from Windows 11. I switched over to Endeavor yesterday and it just started happening now. Caps lock works fine, it’s just that it doesn’t turn on/off with just a key press. It turns on/off on release instead.

I don’t, I’m on a laptop, but I’m sure it’s not hardware related. I made a clean install of Endeavor yesterday. I’m a first-time Linux user and Endeavor is my first distro. So far I’m loving it and my only regret is not making the switch earlier.
My capslock worked normal on Windows, except now instead of turning on/off with a press, it turns on/off upon release of the key. It doesn’t feel broken, it’s just annoying because of the way I type I still have my finger on capslock when I hit the first letter of a word.

I am a little confused. Caps lock should turn on with a press but usually requires a press and release to disable.

That being said, why would you use caps lock in that situation? If you want to only capitalize a single character by pressing a key you would generally use the shift key, not caps lock. Are you using a kayboard layout without that functionality?

2 Likes

It’s just not the way I’ve gone about it all these years. I do a caps, hit the letter, and hit caps again real quick. That’s how my hands are trained.

The discussion here might be useful:

4 Likes

I’m did a quick skim of the thread, seems like it’ll fix my issue. When I get around to testing it I’ll update this thread. Thank you very much @kwg

2 Likes

Reporting back to say that it worked like a charm. Perfect solution! You’re the man. Also thanks to Ben on the Manjaro forums for providing the answer. I’m leaving a copy of the answer here just in case.

Manual Method:

Start by creating a copy of your keyboard map:

xkbcomp -xkb $DISPLAY keyboardmap

Edit the exported file (keyboardmap) and enter the text (find the section starting with key and paste over it)

key <CAPS> { repeat=no, type[group1]="ALPHABETIC", symbols[group1]=[ Caps_Lock, Caps_Lock ], actions[group1]=[ LockMods(modifiers=Lock), Private(type=3,data[0]=1,data[1]=3,data[2]=3) ] };

To apply your edited keyboard, file you do this:

xkbcomp keyboardmap $DISPLAY

Now do the typing test again. The caps lock is released when you press - and before you release the capslock key.

Automated Method (better imo):

The manual method works, but it’s a temporary fix. Every time you restart you’ll lose these changes and will have to run the commands again…

It’s possible to automate this whole process though!!

Put the following code in a file:

#!/bin/bash

# Create a copy of the current keyboard map
xkbcomp -xkb $DISPLAY ~/keyboardmap

# Define the replacement text
replacement_text='key <CAPS> { repeat=no, type[group1]="ALPHABETIC", symbols[group1]=[ Caps_Lock, Caps_Lock ], actions[group1]=[ LockMods(modifiers=Lock), Private(type=3,data[0]=1,data[1]=3,data[2]=3) ] };'

# Use sed to replace the specific line in the keyboardmap file
sed -i 's/key <CAPS> {         \[       Caps_Lock \] };/'"$replacement_text"'/' ~/keyboardmap

# Apply the edited keyboard map
xkbcomp ~/keyboardmap $DISPLAY

Save this script as caps_fix.sh and make it executable by running:

chmod +x modify_keyboard.sh

To automate this script at startup, you can add it to your startup applications or include it in your shell profile script (e.g., .bashrc or .bash_profile). Alternatively, you can use your desktop environment’s startup applications manager.

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.