Skip to content

feat: add wrap_size option to app rules for natural window sizing in tiles#353

Open
qeude wants to merge 1 commit intoacsandmann:mainfrom
qeude:feat/force-tile-app-size-wrapping
Open

feat: add wrap_size option to app rules for natural window sizing in tiles#353
qeude wants to merge 1 commit intoacsandmann:mainfrom
qeude:feat/force-tile-app-size-wrapping

Conversation

@qeude
Copy link
Copy Markdown

@qeude qeude commented May 5, 2026

Problem

There is a convenient option to force tiling for some apps using app_rules:

{ app_id = "com.apple.iphonesimulator", workspace = 0, floating = false }

This prevents the Simulator from floating, but it leads to weird sizing behavior because the layout still stretches the window to fill the allocated column size.

Solution

This PR adds a wrap_size option to app_rules. When wrap_size = true and floating = false, the layout column shrinks to wrap the window's actual natural size instead of stretching it to the default column ratio.

Usage

{ app_id = "com.apple.iphonesimulator", workspace = 0, floating = false, wrap_size = true }

How it works

  1. Config: Added wrap_size: bool to AppWorkspaceRule
  2. Virtual Workspace Manager: wrap_size is propagated through AppRuleAssignment and stored per-window in window_rule_wrap_size
  3. Layout Engine: During WindowsOnScreenUpdated, windows with wrap_size get WindowLayoutConstraints with wrap_size: true and is_resizable: false, using their current natural size as locked dimensions
  4. Scrolling Layout: In calculate_layout, if a column contains a wrap_size window, the column width uses the locked width directly instead of the ratio-based width
  5. Resize handling: WindowResized updates the locked dimensions so the column tracks the window's new size

Testing

Added unit tests covering:

  • Config TOML parsing of wrap_size
  • VWM rule assignment producing wrap_size
  • wrap_size suppression when floating = true
  • Layout engine constraint creation
  • Resize-driven constraint updates
  • Scrolling layout column width wrapping

…tiles

When forcing an app to tile (e.g. iPhone Simulator) with floating=false,
the column stretches to the default column ratio, causing sizing weirdness.

This adds a wrap_size option to app_rules that makes the layout column
shrink to the window's actual natural size instead of stretching it.

- Add wrap_size field to AppWorkspaceRule config
- Propagate wrap_size through AppRuleAssignment and VirtualWorkspaceManager
- Store wrap_size in WindowLayoutConstraints and mark as non-resizable
- In ScrollingLayoutSystem, use locked width as column width when wrap_size
  is set, bypassing the normal ratio-based sizing
- Update locked dimensions on WindowResized so the column tracks changes
- Add unit tests for config parsing, VWM assignment, constraint creation,
  resize updates, and scrolling layout column sizing
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