fix(wrap): only collapse single-child wrap for split parents#296
Open
sim590 wants to merge 1 commit into
Open
Conversation
Author
|
Hey! Just a heads up... I recently released hypr-layout 0.1.0, a CLI tool for spawning tiled layouts in hy3 (see reddit post). It works well overall, but tab group support relies on this fix to function properly. No rush, just wanted to mention the context in case it helps with prioritization! |
Match i3/Sway behavior: when wrapping a node that is the only child of its parent, only reuse the parent container if it has a split layout (H or V). If the parent is tabbed or stacked, always create a new wrapper group. Also preserve split-in-split groups when their parent is a tab group, preventing collapseParents from undoing intentional nesting inside tabs. Make movewindow stop at split groups whose parent is a tab instead of traversing through them.
sim590
force-pushed
the
fix/wrap-tab-single-child
branch
from
May 27, 2026 18:34
02af08b to
10132b0
Compare
sim590
added a commit
to sim590/hy3
that referenced
this pull request
May 28, 2026
The merge conflict resolution between outfoxxed#295 (movewindow-tab-containment) and outfoxxed#296 (wrap-tab-single-child) kept only the outfoxxed#296 condition (break_parent->parent isTab) and dropped the outfoxxed#295 condition (group.isTab). Both are needed: outfoxxed#295 stops traversal when break_parent itself is a tab group, outfoxxed#296 stops when a split's parent is a tab. Without outfoxxed#295's check, windows escape tab groups when moved at the boundary.
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.
Problem
When a tab group contains a single split child (e.g.
t(v(a,b))),hy3:makegroup hwith the child group focused does not create a new wrapper. Instead,wrap()takes a shortcut that results in no visible change rather than creating a new wrapper group.Steps to reproduce:
t(v(a,b))hy3:changefocus raisehy3:makegroup hExpected:
t(h(v(a,b)))Actual: No visible change
Three places assume single-child groups are always redundant, without considering that a split inside a tab is intentional:
Hy3Node::wrap()reuses the parent when it has one child, regardless of parent typeshouldCollapseNode()collapses any split-in-split, even inside tabsshiftOrGetFocus()traverses through single-child splits even when their parent is a tabi3 and Sway only apply the single-child shortcut when the parent layout is H or V, not when it is tabbed or stacked.
Changes
Hy3Node::wrap(): addparentGroup.isSplit()to the single-child shortcut conditionshouldCollapseNode(): skip split-in-split collapse when the node's parent is a tab groupmakeOppositeGroupOn(): addgroup.isSplit()to the single-child shortcut conditionshiftOrGetFocus(): break the traversal loop when the current group's parent is a tab