fix(desktop): keep an approval on the screen it appeared on - #184
Merged
Conversation
The HUD is resized every time a card is added or removed: the stack measures itself, reports one number, and the window is set to match. But the bounds carrying that height carried a position too, and the position was recomputed from the pointer on every report. So a second approval arriving after the user had moved to the other monitor took the first one across with it, mid-read. The renderer said "taller"; the main process heard "taller, and move to wherever the pointer is". The corner now belongs to the showing rather than to the resize. HudAnchor picks it from the work area the first time it is asked and holds it until the HUD hides, so a later resize changes only the height. Which display the HUD opens on is unchanged: still the one the pointer is on when the approval lands, and hide() releases the corner so the next one can land somewhere else. Covered by hud-anchor.test.ts, which was checked against the old behaviour: forcing the corner to be recomputed on every call fails the regression case and nothing else. Not verified on two displays — only the built-in one was attached, and there the two versions agree.
3 tasks
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.
Summary
The HUD is resized every time a card is added or removed. The stack measures itself and reports one number — its height — and the window is set to match. The bounds carrying that height carried a position too, and
anchor()recomputed the position from the pointer on every report.So a second approval arriving after you had moved to the other monitor took the first one across with it, mid-read. The renderer said "taller". The main process heard "taller, and move to wherever the pointer is".
HudAnchornow picks the corner from the work area the first time it is asked and holds it until the HUD hides. A later resize changes only the height. Which display the HUD opens on is unchanged — still the one the pointer is on when the approval lands — andhide()releases the corner so the next one can land somewhere else.Found while debugging a report of desktop notifications disrupting focus. Two other causes turned up and are not in this PR: a stale dev instance doubling every notification (environmental), and AeroSpace switching workspace when Helios is activated, which needs a decision about
app.focus({ steal: true })inHud.focus()rather than a bug fix.Measured and cleared of blame: the HUD is a non-activating panel, and showing or clicking it raises neither
did-become-activenorbrowser-window-focus. The panel fix from #111 works. The window moving was the whole of it.Test plan
npm test— 297 pass, 0 fail (5 new inhud-anchor.test.ts)npm run typecheck— cleannode build.mjs— cleannot ok 3 - a card arriving after the pointer moved does not follow it) and nothing else