Repository navigation
fix(widget): turning the widget on no longer squeezes the panel into a pill - #228
Conversation
…a pill The Widget toggle sets compactMode and then compactExpanded, and both layout sinks ran inline in @published's willSet. The second therefore laid out pill mode against the stale expanded flag: a pill-sized window around the full panel, after which the hotkey toggled from the broken state. Both sinks now lay out on the next run-loop turn, once the values have landed. Callers that set the flag and lay out explicitly are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StuBehan
left a comment
There was a problem hiding this comment.
The comment in handlePostUpdateStatus says applyCompactLayout already ran via the Combine sink, which isn't true now the sink waits a turn. The explicit call under it is the only layout before the mode flip, so could the comment say that?
hiskudin
left a comment
There was a problem hiding this comment.
Review by Claude, from Hisku's session.
LGTM. The diagnosis is right: @Published sinks fire in willSet, so the second sink laid out against the stale flag, and deferring a turn fixes it.
Optional: .receive(on: DispatchQueue.main) before .sink is the usual Combine spelling of the same deferral. Callers that set a flag and then call applyCompactLayout() themselves now get a second, deferred pass, which looks harmless since layout is idempotent.
- Reword the handlePostUpdateStatus comment: the sinks now lay out a turn later, so the explicit applyCompactLayout() is the only layout before the mode flip. - Defer the compact-layout sinks with .receive(on: DispatchQueue.main) instead of wrapping the call in DispatchQueue.main.async. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reworded the |
Summary
Turning Widget on in Settings could leave the panel squeezed into a pill-sized window around the full panel, after which the hotkey toggled from the broken state. The two layout sinks now run on the next run-loop turn.
Changes
nav.$compactModeandnav.$compactExpandedsinks inPanelControllercallapplyCompactLayout()throughDispatchQueue.main.async.@Publishedsinks fire inwillSet, and the Widget toggle setscompactModeand thencompactExpanded, so the second sink laid out pill mode against the stale expanded flag.applyCompactLayout()themselves are unaffected.PanelController's setup and need a liveNSPanel. Verified by hand (below).Testing
Automated:
./build.sh(no new warnings),make test-without-xcode(1447 tests, 0 failures),make typecheck-tests.Manual, after
make reload:M) and confirm it expands to the full panel.Related issues
None.
🤖 Generated with Claude Code
Summary by cubic
Fixes the widget toggle squeezing the panel into a pill-sized window.
The Widget toggle sets
compactModeand thencompactExpanded, and both layout sinks ran inline in@Published'swillSet, so the second sink laid out pill mode against the stale expanded flag. Both sinks now run on the next run-loop turn, once the values have landed. Callers that set a flag and callapplyCompactLayout()themselves are unaffected.Written for commit 0edc9fd. Summary will update on new commits.