Skip to content

fix(wrap): only collapse single-child wrap for split parents#296

Open
sim590 wants to merge 1 commit into
outfoxxed:masterfrom
sim590:fix/wrap-tab-single-child
Open

fix(wrap): only collapse single-child wrap for split parents#296
sim590 wants to merge 1 commit into
outfoxxed:masterfrom
sim590:fix/wrap-tab-single-child

Conversation

@sim590

@sim590 sim590 commented Apr 27, 2026

Copy link
Copy Markdown

Problem

When a tab group contains a single split child (e.g. t(v(a,b))), hy3:makegroup h with 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:

  1. Create a tab group with a vertical split: t(v(a,b))
  2. Focus the vertical group with hy3:changefocus raise
  3. Run hy3:makegroup h

Expected: 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 type
  • shouldCollapseNode() collapses any split-in-split, even inside tabs
  • shiftOrGetFocus() traverses through single-child splits even when their parent is a tab

i3 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(): add parentGroup.isSplit() to the single-child shortcut condition
  • shouldCollapseNode(): skip split-in-split collapse when the node's parent is a tab group
  • makeOppositeGroupOn(): add group.isSplit() to the single-child shortcut condition
  • shiftOrGetFocus(): break the traversal loop when the current group's parent is a tab

@sim590

sim590 commented May 22, 2026

Copy link
Copy Markdown
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
sim590 force-pushed the fix/wrap-tab-single-child branch from 02af08b to 10132b0 Compare May 27, 2026 18:34
@sim590
sim590 changed the base branch from 0.54 to master May 27, 2026 18:35
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.
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.

1 participant