feat: add one-shot sticky modifiers#720
Conversation
Binary Size Reportuse_config/nrf52832_bleDiffuse_config/nrf52840_bleDiffuse_config/nrf52840_ble_splitDiffCentral DiffPeripheral Diffuse_rust/nrf52840_ble_splitDiffCentral DiffPeripheral Diffuse_config/pi_pico_w_bleDiffuse_config/pi_pico_w_ble_splitDiffCentral DiffPeripheral Diffuse_rust/pi_pico_w_ble_splitDiffCentral DiffPeripheral Diffuse_config/rp2040Diffuse_config/rp2040_splitDiffCentral DiffPeripheral Diffuse_rust/rp2040_splitDiffCentral DiffPeripheral Diffuse_config/stm32f1Diffuse_config/stm32f4Diffuse_config/stm32h7Diff |
de53682 to
3f613b6
Compare
|
Updated the docs, squashed all WIP commits. |
| one_shot_modifiers = { | ||
| activate_on_keypress = false, | ||
| send_on_second_press = false, | ||
| release_modifier_keys = [], |
There was a problem hiding this comment.
send_on_second_press indicates that the current modifier is released by pressing the same key, so it's kinda overlapped with release_modifier_keys?
I suggest to remove release_modifier_keys and make send_on_second_press defaults to true.
There was a problem hiding this comment.
I think that ability to set explicit keys to cancel/release OSSM is better, because with that you can set one key to release all modifiers. Without that, you'll need to press every OSM to cancel and you can make mistake.
send_on_second_press is primarily for the case where you want to trigger the key tap, for example, bring Windows Start Menu or something like that in other OS.
while release_modifier_keys are for explicit release of all OSM modifiers.
There was a problem hiding this comment.
I don't really understand, IIRC in current implementation, all OSM modifiers are cancelled after a non-letter keys is pressed, I thought it was enough for this case?
There was a problem hiding this comment.
OSM is canceled/released when:
- other non-OSM key is pressed (that will trigger a shortcut ModifierCombination+Key)
- timeout has passed (ModifierCombination will release alone)
If the timeout is set to a very big number (like minutes), then the second option doesn't suit us.
But we want to release modifiers without triggering unnecessary shortcut.
Therefore, we use third option: release_modifier_keys which release mods without triggering any shortcuts.
Why timeout could be set to very big number: in some apps, there are alternative scroll mode (fast scroll, or side scroll). If you want to trigger that behavior, but you don't want to hold the mod for the whole period, you use OSSM with a big timer and release that modifier when it is not needed anymore.
There was a problem hiding this comment.
Why timeout could be set to very big number: in some apps, there are alternative scroll mode (fast scroll, or side scroll). If you want to trigger that behavior, but you don't want to hold the mod for the whole period, you use OSSM with a big timer and release that modifier when it is not needed anymore.
Sorry, maybe I didn't make it clear. I think the "cancelling" behavior can be achieved by tapping the same OSSM key again. My expected behavior is:
- Tap OSSM key for the first time: activate OSM immediately
- Tap the same OSSM key for the second time within the timeout time: cancel current OSSM
- Tap other keys within the timeout time: modifier combination + key
With this behavior, you can open Windows Start menu by pressing OSM twice, and can also use OSSM in the scroll mode.
That simplifies the configuration too and saves lots of ram introduced by release_modifier_keys.
Added One-Shot Sticky Modifiers functionality
Moved OSM/OSL logic into
oneshot.rsfileAdded two boolean config variables:
activate_on_keypress: Should modifiers be active from keypress (sticky modifiers)send_on_second_press: Should the second keypress send modifiers and unstick themUpdated
behavior.mddocs to correspond with the new config structure: