Respect window min size constraints in Niri column width#384
Respect window min size constraints in Niri column width#384biswadip-paul wants to merge 2 commits into
Conversation
…size constraints in Niri column width resolution Previously, layoutConstraints were unconditionally relaxed via relaxedForResizePlaceholder(), dropping minWidth/minHeight to 1 for all windows. This meant the layout engine couldn't clamp column widths to respect app minimum sizes, causing apps like WhatsApp to trigger resize placeholders (or get parked offscreen) when the column preset was narrower than the app's minimum width. Now, constraints are only relaxed for windows already in a resize placeholder state. For all other windows, the full constraints propagate to the layout engine, allowing resolveSpan() to clamp column widths up to the app's minimum size. This prevents unnecessary resize placeholders and keeps apps usable at any column width preset. Fixes BarutSRB#383 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughbuildWindowSnapshots now reads resizePlaceholderState first and applies relaxed constraints only when that state exists; otherwise it uses mergedConstraints. Tests add a regression verifying large minimum sizes clamp widths without emitting a placeholder and seed a placeholder in another test to validate the relaxed-constraint path. ChangesConditional Constraint Relaxation for Resize Placeholders
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Tests/OmniWMTests/NiriLayoutEngineTests.swift`:
- Around line 4093-4096: The test force-unwraps frameChange after a prior
`#expect`, which can crash and hide the real failure; instead safely unwrap the
optional returned from plan.diff.frameChanges.first { $0.token == token } (e.g.,
use guard let or if let to bind frameChange) and then run the subsequent
assertions on the bound value (replace direct use of frameChange! with the
unwrapped variable before checking .frame.width), keeping the original `#expect`
check or converting it into an explicit failure path that reports a clear test
error if the optional is nil.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 44d831ee-8217-4912-8222-891a1626bd10
📒 Files selected for processing (2)
Sources/OmniWM/Core/Controller/LayoutRefreshController.swiftTests/OmniWMTests/NiriLayoutEngineTests.swift
…th guard-let in test assertion Avoids crashing the test runner if frameChange is nil, surfacing the failure via Issue.record instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
layoutConstraintswere unconditionally relaxed viarelaxedForResizePlaceholder(), droppingminWidth/minHeightto 1 for all windows — preventing the layout engine from clamping column widths to respect app minimum sizesresolveSpan()to clamp column widths up to the app's minimum sizeFixes #383
Test plan
NiriLayoutEngineTests🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests