houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
260 stars 22 forks source link

Output on key release behavior #11

Closed Azarattum closed 2 years ago

Azarattum commented 2 years ago

As I promised https://github.com/houmain/keymapper/issues/5#issuecomment-904007240 this is a more detailed report on 'output on key release' behavior.

First of all, the suggested

Meta{X} >> $(B)
Meta >> $(A)

works surprisingly well! It perfectly mimics the ~ syntax. Moreover, this syntax is adaptive, meaning that if we remove Meta{X} >> $(B) part, Meta >> $(A) will execute of key down, when otherwise on up. I really like the simplicity of that, but I think the concept should be explained more clear in documentation for new users without them diving in the functional principle. Preferably with examples (the easiest way to understand it in my opinion).

The other weird behavior arises from using the output on release feature on windows.

A >> B^

While the expression above works as expected on Linux, it has absolutely no effect on Windows. My guess is that the operating system is doing repeat when a key is down which counts as a separate presses. I'm not sure if there is a way around this, but generally it's not a big deal.

And lastly, I want to suggest a quality of life improvement. Automatically treat A >> $(cmd) as A >> $(cmd)^. I'm cannot imagine a case when you need to spawn lots of windows while a key is down. I guess with the current state of things, everyone will just going to spam ^ after every command execution which wouldn't make for a pretty config.

houmain commented 2 years ago

Are you using the -i parameter on Windows? I have not implemented this feature with Inception, yet. But I will do so now, thanks for the reminder. Otherwise it should already work. On my machine it does, I am currently only using this feature on Windows.

Automatically treat A >> $(cmd) as A >> $(cmd)^. I'm cannot imagine a case when you need to spawn lots of windows while a key is down

I think it could be useful for changing volume or resizing a window with wmctrl... I just checked the behavior of the application shortcuts of my window manager (XFCE) and it also starts one process per key repeat. I think I never accidentally started more than one and adding a ^ after most $(), to be save, is not too bad. I will add a note in the documentation.

Azarattum commented 2 years ago

I didn't use the interception. I usually start the program as administrator to make it work with things like the task manager etc.

houmain commented 2 years ago

Now A >> B^ should also work on Windows as expected. I only used/tested A >> B^C on Windows, sorry.

I have not implemented this feature with Inception, yet. But I will do so now.

I could not get Interception working. The driver seems to get installed correctly, but the samples are not working either...

I usually start the program as administrator

It's spawning the terminal commands as administrator now, right?

Azarattum commented 2 years ago

It's spawning the terminal commands as administrator now, right?

Yeah, and I like it this way. As you don't have sudo on Windows, the Administrator terminal is far superior. I have a rule in task scheduler to start the program with admin privileges when I log into my system.