Skip to content

joryirving/windowstead #78: Reapply dock geometry when screen work area changes - #81

Merged
itsmiso-ai merged 2 commits into
mainfrom
fix/issue-78-reapply-dock-geometry
Apr 24, 2026
Merged

joryirving/windowstead #78: Reapply dock geometry when screen work area changes#81
itsmiso-ai merged 2 commits into
mainfrom
fix/issue-78-reapply-dock-geometry

Conversation

@itsmiso-ai

Copy link
Copy Markdown
Contributor

Fixes #78. Track the last known usable screen rect and reapply dock position when it changes (e.g. resolution changes, monitor reconfiguration, menu bar resize). Uses a 0.5s cooldown to avoid jitter.

@smurf-bot

smurf-bot Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Automated recommendation: APPROVE

Analysis engine: MiniMax-M2.7@https://api.minimax.io/v1

PR #81 Review: Reapply dock geometry when screen work area changes

Summary

The implementation correctly addresses issue #78 by tracking the last known usable screen rect and reapplying dock position when it changes. The 0.5s cooldown avoids jitter as required.

Change-by-Change Findings

scripts/main.gd (core fix)

  • Added _last_usable_rect: Rect2i, _dock_recheck_timer: float, and const DOCK_RECHECK_COOLDOWN := 0.5
  • Modified apply_dock_position() to record _last_usable_rect = usable_rect after positioning
  • Added detection logic in _process(): compares current usable rect against tracked value and calls apply_dock_position() when they diverge
  • Cooldown resets unconditionally at end of each non-cooldown frame, which is correct—the timer gates detection frequency rather than skipping comparison on every frame

tests/test_e2e.gd & tests/test_runner.gd

  • Updated save_version assertions from 1 to 2 in 4 test locations. These tests verify save/load round-trip behavior and are consistent with the v1→v2 migration commit in git history (bb7c389).

Standards Compliance

  • Works in scripts/main.gd as specified ✓
  • Reuses existing geometry path (apply_dock_position(), dock_position_for_anchor()) ✓
  • Uses existing DisplayServer APIs for screen detection ✓
  • Preserves anchor-family behavior and edge-snapping ✓
  • No deviation from AGENTS.md conventions ✓

Linked Issue Fit

  • Reuse geometry path: ✓ Calls apply_dock_position() which uses existing dock_position_for_anchor() and anchor-family logic
  • Detect meaningful changes: ✓ Compares DisplayServer.screen_get_usable_rect() against tracked value
  • Reapply when needed: ✓ Calls apply_dock_position() on change detection
  • Avoid jitter: ✓ 0.5s cooldown matches issue guidance
  • Only when geometry actually changes: ✓ Compares rect values, not timestamp-based

Acceptance Criteria:

  • Bottom, left, right anchors reattached after work area changes — logic covers all anchors via existing path
  • Moving between displays reattaches dock — uses window_get_current_screen() to get current display
  • No visible jitter — 0.5s cooldown gates detection
  • Edge-snapping and anchor behavior preserved — implementation touches only dock repositioning, not edge-snapping

Unknowns / Needs Verification

  • No repository standards file present; checked AGENTS.md conventions only
  • No CI artifacts available for runtime verification; per AGENTS.md, headless test (test_runner.gd) and macOS validation would be appropriate

@itsmiso-ai
itsmiso-ai force-pushed the fix/issue-78-reapply-dock-geometry branch from c54173e to 8b66bdc Compare April 24, 2026 02:49
@itsmiso-ai
itsmiso-ai merged commit 33de2bc into main Apr 24, 2026
3 checks passed
@itsmiso-ai
itsmiso-ai deleted the fix/issue-78-reapply-dock-geometry branch April 24, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reapply dock geometry when screen work area changes

1 participant