The issue seems to be Keysharp interfering!
Original post:
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.


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!
Dang, sorry to read about your ban. By the way, I think it is Keysharp that is causing the problem because it seems to be working just fine when I have that app disabled. I do like it a lot though, so I’ll keep tinkering and finding some way to possibly try to get both of them to work concurrently. It uses Microsoft’s .NET 10 runtime, but the latest versions have been having issues on my PC, so I’ve been going without Keysharp, and the Caps Lock reconfiguration is working flawlessly, haha. Thanks for your patience!
Thank you for the update! Just to clarify, I am sorry, what is KeySharp exactly? Is it one of the following?:
- https://github.com/goaaats/KeySharp
- https://github.com/mfeemster/keysharp
- https://apps.microsoft.com/detail/9nkmq5kbjg59
None of the above, ironically; it’s: https://github.com/Descolada/Keysharp
Thank you very much for sharing!
AutoHotKey (AHK) are quite great for Windows, yet I am not sure about Linux, where you may have even more featureful and optimal solutions based on Xorg/Wayland, and/or your desktop environment (e.g., KDE Plasma).
Unless you don’t want/have time to migrate these Windows-oriented scripts, are you sure you want to depend on them?
I ported over as much as I could to Espanso, yeah. I appreciate your concern and would ideally ditch this software too but the problem is that I haven’t found a really competent equivalent; Python is just way too tricky to figure out and libraries like pywinauto or whatever it’s called are really limited in terms of what they’re capable of doing (not enough!), or AutoKey is just insanely complex with so many files being needed versus just one master file that one can use with AutoHotkey (which I also use at my Windows-mandated workplace).
For example, one frequently used script of mine in AutoHotkey/Keysharp purges the clipboard’s URL of all known trackers before pasting, even doing HTML-decoding as needed if encoding is detected. I haven’t been able to find anything that can as easily do this on Linux, though I suppose I could poke around more, or if worse comes to worst, try to have an AI build a cross-platform one, haha.
As we know, it depends on the actual environment, where simpler or more complex options are available out-of-the-box.
Meanwhile, have you tried?:
- https://github.com/hluk/copyq
- https://copyq.readthedocs.io/en/latest/scripting.html
In CopyQ, since its compiled with the clipboard event handling, it’s sure possible to handle these events, including changing the content or launching custom scripts, and though I don’t like Python, I do like JavaScript, and CopyQ has built-in support for quite limited but JavaScript with its own API function built-in to handle it, mentioned in the documentation above.
Preview of the settings I’ve just checked out in a Kubuntu machine I had on hands:
And it worked! The quick scripts I tried are the following:
The one for CopyQ (I had v6.0.1)
Apparently, it does not support
copyq: try { var original = str(clipboard()); } catch(e) { abort(); } // If empty or too long if (!original || original.length > 10000) { abort(); } try { var executed = execute('/home/user/scripts/clean-url.sh', original); } catch(e) { abort(); } // If failed to execute if (!executed) { abort(); } var cleaned = str(executed.stdout).trim(); // If empty or matches the original (CopyQ may get into a loop otherwise) if (!cleaned || !cleaned.length || cleaned === original) { abort(); } // Change the clipboard buffer copy(cleaned);That program or script, to clean it, may be anything you prefer of course, including Bash, Perl, PHP, JavaScript, or what AutoHotKey does/executes in your case possibly.
There’s the following to automate the read/write I know but haven’t used, too:
- https://github.com/Slackadays/Clipboard
In Wayland, you may use
wl-pasteto read, andwl-copyto write into the clipboard.In X11,
xclipto both read and write.The thing is that there should be some kind of event to handle on the clipboard change, and there options as DBus or Qt, yet I am not currently aware of a verified option to do so without an actually compiler program to subscribe to such an event.
For instance, Klipper, the Qt program, uses the even handling over DBus exposed via its libraries for convenience.