Skip to content

Re-evaluate "default_orientation auto" when workspaces change outputs#9045

Open
mil-ad wants to merge 6 commits into
swaywm:masterfrom
mil-ad:smarter-auto-orientation
Open

Re-evaluate "default_orientation auto" when workspaces change outputs#9045
mil-ad wants to merge 6 commits into
swaywm:masterfrom
mil-ad:smarter-auto-orientation

Conversation

@mil-ad
Copy link
Copy Markdown
Contributor

@mil-ad mil-ad commented Feb 22, 2026

When default_orientation auto is set, workspace layout (horizontal vs vertical) is determined by output dimensions at creation time but never re-evaluated. This means a workspace created on a landscape display keeps L_HORIZ even after moving to a portrait display, which defeats the
purpose of auto orientation in multi-monitor setups.

This patch adds workspace_reorient_auto() which re-evaluates the layout based on the current output's aspect ratio. It is called when:

  • A workspace is moved to a different output (move workspace to output)
  • An output is disconnected and workspaces evacuate
  • An output is reconnected and workspaces restore back
  • An output's mode or transform changes (e.g. rotation)

The function is conservative and only acts when:

  • default_orientation is auto (explicit horizontal/vertical is never touched)
  • The workspace has at most 1 tiling child (existing multi-window layouts are preserved)
  • The workspace is not tabbed or stacked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant