Skip to content

Cycle Super + L on into a floating workspace - #8260

Closed
omarchybot wants to merge 3 commits into
quattrofrom
workspace-floating-mode
Closed

omarchybot wants to merge 3 commits into
quattrofrom
workspace-floating-mode

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

Super + L toggled the active workspace between the dwindle and scrolling tiled layouts. It now cycles dwindle → scrolling → floating → dwindle, and on a floating workspace every window floats.

Floating cannot be a third layout

Hyprland has no tiled layout called floating, and it does not complain when asked for one. hl.workspace_rule({ workspace = "1", layout = "floating" }) returns ok and leaves the workspace on dwindle — the same silence a misspelt name gets. The one-word version of this change would have been a no-op that still announced "Workspace layout set to floating". hyprctl activeworkspace names the field tiledLayout for the reason underneath that: floating is a property of a window, not an arrangement of them.

So the mode floats the windows themselves, through the same float dispatcher Super + T uses. default/hypr/workspace-modes.lua holds it, and bin/ reaches it through hyprctl eval, which shares the config's Lua state.

Giving back only what it took

Ending the mode has to tile the windows the mode floated and leave the rest alone, so each one it floats is tagged omarchy-mode-floated. A window already floating when the mode reaches it — an app with a float rule of its own, a dialog, one popped out with Super + T — is never claimed, and is still floating when the mode ends. Without that, one trip through floating would tile every window that is meant to float always: everything tagged floating-window in apps/system.lua, and org.omarchy.terminal, imv, mpv, 1Password among them.

The tag lives on the window rather than in a table on the Lua side, because a table does not survive hyprctl reload — which omarchy-hyprland-monitor-watch performs when a monitor is plugged in, and omarchy-hyprland-window-gaps-toggle on a keypress. A reload rebuilds the Lua state, and provenance kept there would be lost while the windows stayed floating, so leaving the mode afterwards would strand them. The tag also follows a window between workspaces and dies with it, so nothing has to be cleaned up when a window closes.

A pinned window is left alone entirely: tiling one unpins it too, and it was put above everything on purpose.

Why events rather than a window rule

Windows arrive on a workspace three ways and a rule only covers one. window.open catches what opens there, window.move_to_workspace what is carried in, and the same event what is carried back out — which gives up the floating the mode gave it rather than leaving it floating on a workspace that tiles. A rule also cannot tell a window it floated from one that was floating already, which is the distinction the whole of the section above rests on.

Every tiled window is claimed in one pass before any is floated in the next, because floating one member of a group floats the rest, and claiming as it went would find those already floating and leave them stranded.

What remembers the mode

The saved file, not the compositor. Hyprland reports a workspace's tiled layout and floating is not one, so a floating workspace still answers dwindle or scrolling; a cycle that trusted that answer would skip a step. A file saved before floating existed names a layout rather than a mode, falls through to what Hyprland reports, and is rewritten by the next press, so nothing needs migrating.

Two faults that had to go first

Saving the mode makes both of them persistent rather than momentary.

Named workspaces report a negative id, which passed the old ^-?[0-9]+$ guard, and Hyprland reads a leading - as a selector relative to the current workspace. Pressing Super + L on a named workspace reconfigured workspace 1 instead — name:mail reports -1337, and targeting it moved workspace 1 to scrolling. It would now also save a file that did the same at every login. Such a workspace is left alone.

A migration removes the ones an earlier version already wrote, because the guard only stops new ones and the files on disk go on being loaded at every login.

The saved state was written under $HOME/.local/state while the Hyprland side reads XDG_STATE_HOME, and that had to reach package.path as well: the loader lists the directory but loads the files by module name, so a state home anywhere else listed the saved layouts and then loaded same-named ones from the home directory. toggles.lua already solves this the same way.

Applying and saving fail separately

Reaching the compositor and reaching disk are different things that go wrong for different reasons, and the next press reads the mode back from the file. A save that failed quietly would leave the cycle running between two modes and never arriving at the third, so it is reported: a mode that applied but could not be saved says so rather than counting as set.

The keyword fallback is gone

The old script fell back to hyprctl keyword workspace "<id>, layout:<layout>" when the Lua call failed. hyprctl keyword refuses a Lua configuration outright — keyword can't work with non-legacy parsers. Use eval. — and exits 0 while doing so, so as a fallback it neither worked nor reported that it had not. A failed apply now says so and saves nothing, rather than announcing a layout the screen does not show and restoring it at the next login.

Consequences, for a decision rather than a fix

  • A window opening while another window on that workspace is fullscreen takes the fullscreen with it. That follows from floating at the open event instead of at map time, and the event is what makes ownership knowable; the window is visible and focusable either way.
  • Super + L now does nothing at all on a named workspace, where it previously did something wrong to a different one. Making it work there is a separate change: the mode would have to be keyed by name while the move handler sees numeric ids.
  • The mode is per workspace and the cycle acts on the active one, so each workspace keeps its own.
  • Grouping is the edge the ownership model does not reach. A window opened into a group that is already floating inherits the group's floating state, so the mode never claims it and it stays floating when the mode ends; and tiling a claimed window tiles its unclaimed group members with it, because Hyprland floats and tiles a group as one. Following group membership as it changes is a larger piece of bookkeeping than the rest of this put together, and it is worth deciding whether it is wanted before it is written.
  • Super + O mis-fires on a window that is floating, because omarchy-hyprland-window-pop begins by toggling float on anything unpinned. That is true today of any window with its own float rule; a floating workspace only makes it easier to meet. It belongs in its own change.

The first commit is separate because it is a different bug: Lua 5.5 exits 0 when a failing script arrives on stdin, so the heredoc form this test used made every Lua assertion in it unfailable — pointing one at a layout the toggle never writes still left the file green. It runs as a script file now.

Checked by Codex at xhigh as an independent reviewer.

dhh and others added 2 commits August 25, 2026 18:12
Lua 5.5's standalone interpreter exits 0 when the script that raised the error came in on stdin, and exits 1 for the same error in a script file. The block here was piped in through a heredoc, so every assertion in it reported as passing however wrong the value was: changing the expected layout to one the toggle never writes still left the file green.
Super + L cycled a workspace between dwindle and scrolling. It now carries on into floating, where every window on the workspace floats.

Floating cannot be a third `layout` on the workspace rule. Hyprland has no layout by that name and accepts one anyway: `hl.workspace_rule({ layout = "floating" })` returns ok and silently leaves the workspace on dwindle, exactly as a misspelt name does. So the mode floats the windows themselves, through the same `float` dispatcher SUPER + T uses.

Ending the mode has to tile the windows the mode floated and only those, so each one is tagged with `omarchy-mode-floated`. A window already floating when the mode reaches it -- an app with a float rule of its own, a dialog, one popped out with SUPER + T -- is left unclaimed and is still floating when the mode ends. The tag lives on the window rather than in a table here: it dies with the window, follows it between workspaces, and survives the config reload that plugging in a monitor performs, none of which a table on this side would do. A pinned window is left alone entirely, because tiling one unpins it as well.

Windows arrive on a workspace three ways and a window rule only covers one of them, so the mode watches events: window.open for what opens there, window.move_to_workspace for what is carried in, and the same event for what is carried back out, which gives up the floating the mode gave it rather than staying floating on a workspace that tiles. Every tiled window is claimed before any of them is floated, because floating one member of a group floats the rest, and claiming as it went would find those already floating and leave them stranded.

The mode is read back from the saved file rather than from the compositor. Hyprland reports a workspace's tiled layout and floating is not one, so a floating workspace still answers dwindle or scrolling; trusting that answer would skip a step of the cycle. A file saved before floating existed names a layout rather than a mode and falls through to what Hyprland reports, so the cycle keeps working and the next press rewrites it.

Two faults in the old script had to go first, because saving the mode makes both persistent. Named workspaces report a negative id, which passed the `^-?[0-9]+$` guard, and Hyprland reads a leading "-" as a selector relative to the current workspace: pressing Super + L on a named workspace reconfigured workspace 1 instead, and would now save a file that did it again at every login. And the saved state was written under $HOME/.local/state while the Hyprland side reads XDG_STATE_HOME, which also had to reach package.path: the loader lists that directory but loads the files by module name, so a state home anywhere else listed the saved layouts and then loaded same-named ones from the home directory.

Saving is checked too. The mode reaching the compositor and the mode reaching disk are separate things that can fail separately, and a save that failed silently would leave the next press reading a file that never got written, cycling between two modes and never reaching the third.

The guard against named workspaces stops new files being written, but an earlier version already wrote them, and they go on being loaded at every login. A migration removes the saved layouts named for a negative id.

The keyword fallback is gone. `hyprctl keyword` refuses a Lua configuration outright -- "keyword can't work with non-legacy parsers. Use eval." -- and exits 0 while doing so, so as a fallback it neither worked nor reported that it had not. A failed apply now says so and saves nothing, rather than announcing a layout the screen does not show and restoring it at the next login.

Co-Authored-By: Codex XHigh <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a persistent per-workspace floating mode to the existing layout cycle.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Cycles dwindle → scrolling → floating.
  • Tracks mode-floated windows and handles window events.
  • Adds migration, persistence fixes, tests, and documentation.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bin/omarchy-hyprland-workspace-layout-toggle Applies and persists workspace modes.
default/hypr/workspace-modes.lua Implements floating-mode ownership and events.
default/hypr/workspace-layouts.lua Loads persisted modes from XDG state.
default/hypr/bindings/tiling.lua Renames the binding description.
migrations/1787679775.sh Removes invalid named-workspace state.
manual/04-navigation.md Documents floating workspace behavior.
manual/07-hotkeys.md Updates the shortcut reference.
test/shell.d/hyprland-workspace-layout-test.sh Expands mode, migration, and persistence tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +42 to +43
if window.floating then
return

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and it is the limitation an independent Codex review at xhigh raised too. It is written up in the pull request body under Consequences, for a decision rather than a fix rather than left for someone to discover.

Both directions are real, and for the reason you give: Hyprland floats and tiles a group as one target, so a window opened into a mode-floated group arrives already floating and is never claimed, while tiling a claimed member takes unclaimed ones with it.

What stops it being a small fix is that Hyprland 0.56 has no grouping event to hang ownership on. The window events its Lua API exposes are open, open_early, close, destroy, move_to_workspace, active, class, title, fullscreen, pin, urgent, kill and update_rules — nothing for a window joining or leaving a group. Ownership would have to be re-derived by polling group membership, which is more bookkeeping than the rest of this change put together. That is worth deciding on deliberately rather than slipping in beside the feature.

Comment on lines +115 to +116
for _, window in ipairs(claiming) do
set_floating(window, true)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not introduced here. The branch does not touch bin/omarchy-hyprland-window-pop, and on quattro today that command already toggles floating on anything unpinned: pressing Super + O on any window that is already floating — org.omarchy.terminal, imv, mpv, a 1Password window, or one popped out earlier and unpinned since — tiles it instead of popping it. A floating workspace makes that easier to meet; it does not create it.

Teaching pop to preserve whether the window was already floating, on the way in and on the way back out, is a real fix and worth doing. It belongs in its own change against that command, where it can be tested against the app-floated cases that already hit it, rather than folded in here. It is noted in the pull request body for that reason.

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes workspace layout cycling behavior and adds floating mode.

The PR appears safe to merge, with non-blocking test gaps around reload recovery and custom state cleanup.

Findings

  1. P2 Reload recovery is untested ▶
  2. P2 Custom state cleanup is untested ▶

Summary

Super + L now cycles through dwindle, scrolling, and floating. Floating mode tags the windows it changes so it can restore them later without tiling windows that already floated.

  • Saved modes use XDG_STATE_HOME, and the loader defines o.workspace_mode before reading them.
  • The migration removes old negative-id workspace files.
  • No blocking defect was established. Two test gaps remain: reload recovery and cleanup in a separate custom state directory.

Acknowledgments from omarchybot in the supplied PR description:

  • Named workspaces are intentionally unsupported until modes can be keyed by name.
  • Fullscreen changes when a window opens are an accepted consequence of using the open event.
  • Group ownership limits are known; tracking membership changes is deferred.
  • The existing Super + O behavior on floating windows belongs in a separate change.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Super + L"] --> B["Read saved mode"]
  B --> C["Choose next mode"]
  C --> D["Apply through o.workspace_mode"]
  D --> E{"Floating?"}
  E -->|Yes| F["Tag tiled windows, then float them"]
  E -->|No| G["Set tiled layout and tile claimed, unpinned windows"]
  F --> H["Save mode or report save failure"]
  G --> H
Loading

Reviews (1) · Last reviewed commit: "Merge branch 'quattro' into workspace-fl..." · Reviewed by Greptile

Comment on lines 356 to 358
dofile(os.getenv("OMARCHY_PATH") .. "/default/hypr/bootstrap.lua")
require("default.hypr.helpers")
require("default.hypr.workspace-layouts")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Reload recovery is untested

The tests load workspace-layouts once, then call o.workspace_mode repeatedly. They never rebuild Lua state while the floated windows and their tags remain, so a change that strands windows after a reload could pass.

Add a reload case that preserves those windows and tags, reloads the saved mode, and checks that leaving floating tiles only the claimed windows.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +160 to +163
run_migration() {
env HOME="$migration_home" XDG_STATE_HOME="$migration_home/.local/state" \
HYPRCTL_LOG="$tmpdir/migration-hyprctl.log" PATH="$stub_dir:$PATH" \
bash -euo pipefail "$migration" >/dev/null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Custom state cleanup is untested

run_migration sets XDG_STATE_HOME to the same directory derived from HOME. The migration promises to clean both locations, but this test checks one directory twice. A change that stops cleaning a separate custom directory would still pass.

Add a distinct state directory with a negative-id file and a numbered file. Check that the migration removes only the negative-id files from both locations.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Superseded by #14482, which includes these commits and builds the full floating desktop (titlebars, edge snapping, and the window Shelf) on top of this Super + L cycle.

@ryanrhughes ryanrhughes closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants