I have various “custom hotkeys” set. For example, when F3 is pressed, I run a command to open Kate with a specific text file.
The problem is that it doesn’t just do this once per press/release, but ~28 times per second of holding it down! And there seems to be no checkbox or anything to limit this in the “Custom Shortcuts” GUI.
Now, I’ve practically worked around this by using a handler script which has its own logic to prevent this, but still, this means that for every second I hold down any hotkey, it’s silently DoSing my system with ~28 pointless processes of this script which immediately quit without executing the actual command because they detect that it’s “too soon”. This just feels wrong, even if my system is powerful enough to seemingly not care at all.
Is there really no “proper” way to accomplish this? It seems like such an obvious option to have, almost as if I’m still missing it. But I’ve looked many times, and searched, and asked ChatGPT. There seems to be no such thing. (At least in 5.x.)
Are you intending to hold down that shortcut key, though? If not, it sounds like perhaps that delay setting should be a bit longer for your device to avoid being accidentally triggered?
custom shortcuts feature in plasma is depreciated and going away with plasma 6 (no idea if it’s coming back), so if you are open to looking for another solution for making custom macros, i can recommend input-remapper.
the hold() function looks like it might do what you need.
Hmm. Yes, that’s right, I’m pretty sure that I have changed the default “Rate” (it says “38,88 repeats/s” for me), because it was so sluggish by default for me when entering text. But I didn’t at all connect it in my mind with the custom shortcuts. I guess it makes sense in a way, but I frankly can’t think of any situation where I’d want such “hotkeys” to repeat until I have released the key and then pressed it again. At any rate, surely such a situation must be in the minority of cases?
Even with the default “repeat rate”, which I can’t change back to if I want to be able to type comfortably, there would be an unnecessary risk to run the same hotkey at least another time if you don’t release the key quickly enough.
The only “clean” way I can think of to solve this, other than using that linked-to “input-remapper” thing, would be for me to implement my own daemon script which uses evtest to check for the keyboard’s inputs and handle it all outside of Plasma’s feature, but that feels kind of sad, as if I’m just repeating the same “making my own system inside of the system” madness as I was doing for many years while I was using Windows!
I guess if you all use the default “repeat rate” for keyboard input, you may not have ever had this problem with hotkeys being executed multiple/many times in a row, but I’d still suggest adding a checkbox for this.
(Nearly got a heart attack upon reading that the entire feature was removed in Plasma 6, but luckily that seems to be have been a false alarm…)
I ended up having to use an insane evtest hack to get this working properly (no repeated hotkeys). Sadly, I still had to use Plasma’s “Custom Shortcuts” just to create “dummy” entries for all the hotkeys (with no command set) just so it will “eat” the keystroke and not make random programs that happen to be focused at the time I’m hitting the global hotkeys do all kinds of annoying things because they happen to have the same “local” hotkey.
In other words: I’ve personally found a way around this, but anyone who isn’t willing to go through all this (99.99% of people) will be stuck with the broken Plasma hotkeys that repeat if you don’t carefully and quickly hit the keys. I still haven’t been able to think of one single situation in which anyone would ever want hotkeys to repeat more than once per press. I truly don’t understand this “design choice” by KDE. To me, it seems like it makes the entire feature nearly useless. Why not just have a checkbox?
Volume change keys, brightness change keys, and media seek keys come to mind right away.
You mentioned finding that you had a higher-than-default repeat rate per second - but if you find that you’re getting unintentional repeat presses at all, then I’d still recommend setting the delay (next to that rate) to a longer period. You might be getting unintended repeat keypresses elsewhere, just less noticeable?