kareltucek / firmware

This is fork of UHK's firmware featuring extended macro engine.
Other
82 stars 9 forks source link

Make sticky keys more configurable #50

Closed kareltucek closed 4 years ago

kareltucek commented 4 years ago

Followup of UltimateHackingKeyboard/firmware#299 .

kareltucek commented 4 years ago

Let me know if the initial post remains unclear.

@matthewwardrop I am afraid I am still unclear on the key-related notation you are using. I still see things like press + <Key mapped to > or + <key mapped to + <`>>, where at most one key of a shortcut is clear. I guess that you probably mean specifically the super + backtick combination (mentioned in gnome docs), but from lack of any mention of the super(/gui/win) modifier it could as well be that you are trying to use the backtick itselfs as a modifier (which would be a problem).

(Also a side-reply on the relation of this fork w.r.t. the official one... Without much diplomatic talk, I am the always dissatisfied guy who has (at some point) started hacking the firmware in order to implement (some of the) refused feature requests. The code of the fork is (of course) fully available, but my philosophy is "let the user build it from small but general building blocks" while official philosophy is more of the conservative "keep it nice and simple" kind. As a result, there is some flow of features and bug fixes between the two firmwares, but the fork fits the "decidedly outside of the scope of the official firmware" definition pretty well.)

matthewwardrop commented 4 years ago

Let's try again :). I want the <Alt> + <grave/backtick> shortcut to be sticky, as is <Alt> + <Tab>, when simulating those key presses using <Mod> + <g>; where g here makes sense because it is right next to the default window switching shortcuts in the default mod layout. The solution seems to be either to hard-code some extra keycodes as sticky, or to make it configurable per key mapping. I understand the latter is probably a large chunk of work, and so I'd be happy with hard-code keymaps, and even, if necessary, to compile my own version of the firmware with these changes (that I would make myself). If this is not a highly sought after feature, then I would not want you to waste your time generalising things unnecessarily.

(And thanks for your explanation re:the nature of this repo. I think I have a similar scratch-the-itch approach in many of my projects, but doubt I will have a lot of time to devote here. If that changes, perhaps you can expect some PRs). ;).

kareltucek commented 4 years ago

Alright, I see now.

From my point of view, the possible solutions are:

matthewwardrop commented 4 years ago

That sounds great! Thanks @kareltucek .

For my edification, what are the scancodes that are actually sent on the USB channel for a sticky key with a <alt> + <tab> like keystroke? I presume it is something like:

- <alt> down
- <tab> down
- <tab> up
- time passes
- <alt> up

And so with the <mod> + <g> keystroke, we would tie the <alt> events with the mod key strokes; such as:

<mod> + <g>
- <alt> down
- <grave> down
release <g>
- <grave> up
hold <g>
- <grave> down
release <g>
- <grave> up
release <mod>
- <alt> up

Is that right?

kareltucek commented 4 years ago

Yes, that's right.

The interesting thing about sticky modifiers is that the modifier also releases once another action gets triggered, which can happen even before release of <g>, in that case it looks like (assuming that space is mapped to space on all layers):

press <mod>

press <g>
- <alt> down
- <grave> down

press space
- <alt> up
- <space> down

release <g>
- <grave> up
matthewwardrop commented 4 years ago

Interesting. Is that behaviour unique to your firmware? I don't see that behaviour on stock firmware. When I press + ( + ), and then release , the app switcher does not disappear even when I press space; only when I release the key. Perhaps the sticky behaviour overrides it?

kareltucek commented 4 years ago

Interesting... is your space bound to a scancode action on the layer where you are testing it?

The behaviour should be the same on both firmwares.

matthewwardrop commented 4 years ago

Oh... whoops! I had completely forgotten I'd remapped the Space bar to on the mod layer. That makes a bit more sense.

kareltucek commented 4 years ago

Implemented. $holdKey sticky LA-graveAccentAndTilde macro should work in next release. Also, it will be possible to select one of three "stickiness" strategies to stick always never or smart.

(I will release it once I finish with a few other issues.)

matthewwardrop commented 4 years ago

Nice... Thanks @kareltucek !

matthewwardrop commented 4 years ago

Finally had a chance to play with this, and it works beautifully (once I figured out how to use macros)!

Thanks again!

kareltucek commented 4 years ago

Glad to hear!