I have this set up as a startup script, but it only sometimes triggers, despite setting a 20-second delay:
#!/bin/bash
sleep 2
xmodmap -e "clear lock"
xmodmap -e "keycode 66 = Return"
I have the startup command set to bash "path/Remap_Caps_Lock_to_Enter.sh". What’s going on? It works when I press the triangle button when it doesn’t work on boot.


Boot logs?
Does it run but error or not run at all?
I’m a newb! How do I check boot logs? However, I’m not sure of how relevant those may be (also @Artwork@lemmy.world - I don’t know if that tagged correctly, but I hope so); I just discovered another mysterious piece of the puzzle: it initially works on login, but about 5 min in, something actually undoes the mapping and I have no idea of what; rerunning the script fixes it until the next shutdown.
Other remapping/expansion tools I use are Keysharp and Espanso, if that helps to know, but I don’t have them interacting with Caps Lock… I would like to more easily manage this just through Keysharp, but Keysharp currently can’t seem to block the native function of Caps Lock from simultaneously occurring.
Hmm, another thought I had is that I wish startup times would have no maximum delay; Mint Cinnamon’s max is a 100-second delay; why?.. That’s annoying. That alone could possibly solve this (even if just as a workaround).
Yes, tagging is valid, and I got a notification. Thank you!
I am sorry, but it seems like we have yet to know the actual operating system (OS), distribution, actual paths for the scripts, and Init system (e.g., Systemd, Initd etc.). Did you use Cron, or modify shell configs? We do not know your unique local customized environment, and changes you’ve done, yet, which is required for more precise investigation.
I have almost no idea of what half of what you’re saying is; I’ve heard of systemd, initd, and cron, but I don’t know what exactly they are and I don’t know what “shell configs” are.
I thought it was obvious that I’m running Linux Mint since I posted this in !linuxmint@programming.dev. I’m using Zena, 22.3 on kernel 7.0.0-14, which seems to be the latest one that Update Manager is showing me.
/home/user/another_folder/remap_caps_to_enter.shcontaining the code abovebashthe above path as a commandI see. Thank you for the details shared!
I’ve never experienced Linux Mint, but a quick Google shows an option “Caps Lock acts as Return” in the desktop environment (DE) settings. Is that the main idea?
Regarding the custom script case. Is it possible a system-wide service executes after your boot/startup script, slightly later, remapping it again?
We may try investigating. For instance, in a new terminal on the very system start, via
xev, to try capture the moment it changes:Or manually:
#! /usr/bin/env bash declare s='' s2=''; while :; do s="$( xmodmap -pke | grep -E 'keycode\s+66'; )"; if [[ "$s" != "$s2" ]]; then printf -- ' [%s] Changed from "%s" to "%s".\n' "$( date -- '+%F_%H-%M-%S'; )" "$s2" "$s"; s2="$s"; fi sleep 1; doneI would also try checking out logs:
journalctl --user -f | grep -E 'settings|keyboard|layout|xkb'; # Or: journalctl -f | grep ...Edit 2026-06-13
-- xev -event mapping; ++ xev;Thank you, @Flagstaff@programming.dev (source)
I forgot to check these before already applying it… It’s okay… I’ll just tolerate it for now. I may try the other code later but am wiped out… Thanks for all the ideas, though.
Sincere apologies! Apparently, the
mappingwas in my dated local custom build of the tool…Have you tried recording the general
xev(with no , without any explicit filtering?Your
xevbuild/Man/Info message should list the supported. For example, in v1.2.3, these are supported:$ man xev; # ... -event event_mask When not specified, all events are selected... Available event masks: keyboard mouse expose visibility structure substructure focus property colormap owner_grab_button randr buttonYet, today we found the actual possible culprit, and monitoring the events is probably not required. We know that it will just change, and the issue source should be a separate whole system-wide service that changes your initial change to its own configured, eventually.
There are many custom key remapping tools, including keyd, but I would try realizing/experiment with the standards first, and I appreciate you for still trying! It may help you in the future.
That’s a figment. It doesn’t exist. I had checked the list of possible reassignments and was furious that Enter is, like, literally the only reassignment that isn’t in the list. I mean, unless something recently got added, it wasn’t there a month ago. That’d be sweet if it is now…
I’m not at a PC right now but will check later, thanks.
If I am not mistaken, Linux Mint settings service uses
xkeyboard-config.-–
-–
<option> <configItem> <name>caps:return</name> <description>Make Caps Lock an additional Return key</description> </configItem> </option>Source
The actual commit: 6b30f36201b40fddcf28918eb4c96b13a23b42ae
Yet, I’ve checked in a virtual machine online, and there’s no such, apparently, indeed (sorry).
However, I believe it’s possible to modify it manually in file
/usr/share/X11/xkb/rules/evdev.xml, and I’ve tried quickly the following (after changes to the file, restart thecsd-keyboard; e.g., by killing it). Would it work in your case (I would also try rebooting after)?:Screenshot
Oh, sweet, huh, nice. Thanks a ton for the research; I totally didn’t think to go this route. I’ll try it when I next can!
Update: So, @Artwork@lemmy.world (I don’t know if this will notify you), unfortunately, I did get around to finally trying it but even though the XKB option is picked, it doesn’t seem to actually do anything despite rebooting… but I sure appreciate you poking around and trying; I didn’t even know that file existed or could be modified.
Wonderful day! Yes, thank you! I got the notification for the edit! Marvelous Lemmy!
The main idea is that it feels like a keyboard layout system service executes after your initial script and hence you notice no difference.
I am sorry, but I am not sure I’ll be able to support the case at this moment, or at least a week, thoughtfully enough to be supportive, considering the job and time availability… I am sorry…
Meanwhile, have you considered responding in the forum above that restarting the services, after editing the file, and select the option, do not affect the key events processing?
Also, have you tried clarifying with other experienced people at IRC? Some networks, as Libera (most people from Freenode) and OFTC, may have those who have more time right now, and possibly had your very case, too?:
- https://libera.chat/guides/clients#terminal-clients
- https://www.oftc.net/
- https://netsplit.de/channels/?chat=mint
I’ve been known on Libera with a nickname as Lore (e.g., channel
#linux), but they banned me again, long ago, unfortunately, for trying to protect myself against trolls… so please be careful! Yet, there are indeed truly ingenious, incredibly people!Oh! Please also consider sharing the solution when found!