Repository navigation
fix(agent): shortcut modifier changes that Heed was refusing itself - #27
Merged
Merged
Conversation
Every choice in Shortcut Modifier flashed red. Nothing external held the combinations: Heed was refusing them itself, two ways at once. - The menu rewrote every setting onto the chosen modifier, so the toggle and focus left, which are both H by default, landed on the same combination. A combination belongs to one action, so that pair can never both be registered. Only the settings already under the modifier being replaced move now; one deliberately given a different combination, as the directional shortcuts are, keeps it. - `claim` registers the new set before releasing the old, so a change can be tried before working shortcuts are given up -- but Carbon refuses a combination this process already holds, so any setting whose combination was not moving was refused by its own live registration. Registrations are kept per setting now, and one that is not moving keeps what it has instead of asking again. Two settings on one combination is found before anything is registered, so the log names both sides rather than reporting whichever one Carbon happened to turn down. The later claim is dropped and the rest still register, so a configuration written that way starts with every other shortcut working; the menu still applies all or nothing.
The toggle is H, so the HJKL example put two shortcuts on that key. They differ by modifier and both register, but Shortcut Modifier can then never put them under one modifier, and it refuses the whole change rather than half applying it.
…fier change makes Three ways the first pass got the reporting or the verdict wrong, found reviewing it. A clash between two settings the change never touches used to refuse the change. Two directional settings written onto one combination would refuse every preset for good, blaming the preset, which is the symptom this was meant to end. `claim` reports both sides of every clash now, and the menu only gives up when one of them is a setting it was actually moving. The registrations are deliberately not released before the new set is claimed, so a combination another setting is still holding came back from Carbon as another app having it -- the wrong words again, on the path the README sends people down. Asked of the standing registrations first, it names the setting that has it. `firstClash` returns the combination as well as the two names: the caller reconstructed it from the first claim, which for the numbered shortcut is the first of nine and not necessarily the one contested. The tick in the menu came from the claimed specs while `changeModifiers` read the raw settings, so a toggle whose text parses but whose registration was refused could put the tick on one modifier and replace another, and report success for a change it never made. Both read the settings now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every choice in Shortcut Modifier flashed red and changed nothing. Nothing external held those
combinations — I probed Carbon from a separate process and
⌥⌘and⌃⌥are entirely free. Heedwas refusing them itself, two ways at once.
Two settings pushed onto one combination
The menu rewrote every setting onto the chosen modifier. The toggle is
Hand focus-left wasHin the README's own example, so both became
⌥⌘H. A combination belongs to one action, so thesecond is always refused.
Only the settings already under the modifier being replaced move now. One deliberately given a
different combination — the directional shortcuts carry an extra Option out of the box — keeps it
rather than being flattened onto the same modifier as its neighbours.
Re-asking Carbon for what it already holds
claimregisters the new set before releasing the old one, deliberately, so a change can be triedbefore working shortcuts are given up. But Carbon refuses a combination this process already
holds, so any setting whose combination was not actually moving got refused by its own live
registration — which is why
⌃⌘and⌃⌥⌘failed on five shortcuts each.Registrations are kept per setting now, and a setting that is not moving keeps the one it has
instead of asking for it again.
Saying which two settings collided
Two settings on one combination is found before anything is registered, so the log can name both
sides instead of reporting whichever one Carbon happened to turn down as "already taken by another
app". The later claim is dropped and the rest still register, so a configuration written that way
starts with every other shortcut working; the menu still applies all or nothing.
The README was the trap
The directional example used HJKL, and the toggle is H. The two differ by modifier and both
register happily, but Shortcut Modifier can then never put them under one modifier. The example is
WASD now, with a note saying why.
Checked against real settings, where all four presets used to fail:
⌃⌘(current)⌥⌘⌃⌥⌃⌥⌘With HJKL the last one is genuinely impossible rather than a bug — the toggle would land on
⌃⌥⌘H, which focus-left has — and it now says so instead of "not free". With the WASD example allfour apply. Confirmed by hand in the menu: three saved before the README change, all four after.
265 tests pass, 11 of them new. Also verified live that a deliberately conflicting configuration
(
focusNextHotkeyset to the toggle's own combination) logshotkey ⌃⌘H already toggles Heed, so nothing moves focus to the next windowand registerseverything else.