cajhin / capsicain

Powerful low-level keyboard remapping tool for Windows
353 stars 18 forks source link

Way to handle modifier-only rules or stop rule processing after match? #66

Closed Rast1234 closed 2 years ago

Rast1234 commented 2 years ago

Hi! Thank you for this app, finally i feel like i'm controlling the keyboard, not vice versa.

My keyboard is Microsoft Ergonomic. It has 2 weird buttons: emoji and office.

I'd like to remap them but since office is modifier-only, its remap rule gets triggered when i press emoji or anything involving LCtrl+LShift+LAlt+LWin + (anything). Is there an existing way to stop processing rules after first match?

This situation is weird by itself since someone at Microsoft decided that's a good idea to make Windows react to 4-modifier combo...

my current config:

combo space [&&&&] > key(F18)  # remap emoji button
combo lwin [&.&&] > key(F19)  # remap office button
# pressing "emoji" triggers both F18 and F19
cajhin commented 2 years ago

...and I thought that I have resorted to some ugly hacks that I should be ashamed of. Microsoft has me beat here.

For each keypress, the first matching rule wins and processing always stops after that. In your case, the issue is that when your keyboard sends "shift+ctrl+win+alt+space", this first triggers the combo "shift+ctrl+win+alt" -> the office rule matches. Then a space event follows and the emoji rule matches.

Right now I see no workaround. If you could reset after matching "shift+ctrl+win+alt", then the emoji rule would never be triggered. The only use for the office key would be in combination with other keys, like "shift+ctrl+win+alt+X is shortcut for whatever"

Rast1234 commented 2 years ago

This thing even has a name and long history: there was a hyper key, used as modifier long time ago, and then it was emulated in Windows by pressing all 4 common modifiers ctrl+win+alt+shift. Recently MS decided to use it as action itself to open Office launcher app, AND as a modifier too! For example, hyper+W/office+W/LCtrl+LShift+LAlt+LWin+W opens Word.

https://www.reddit.com/r/windows/comments/d5s1rg/shiftcontrolaltwindowskey_hyper_key_opens_office/

Right now I see no workaround

Is it (or could be) possible to assign action to, say, modifier down, modifier up as opposed to modifier down, other key down, other key up, modifier up? This would also be useful for other modifiers, eg toggle layouts by perssing L/R shifts but still use shifts as normal

offtop: MS's keyboard settings app allows to rebind emoji key to context menu key, which is present physically too. And does not allow rebind of office key at all.