From e150dcdc4c7871dcf9a9362af471c580f3d4fd9f Mon Sep 17 00:00:00 2001 From: LordMelkor <6434954+LordMelkor@users.noreply.github.com> Date: Fri, 13 Nov 2026 07:54:11 -0500 Subject: [PATCH 1/2] Leave self-floating windows out of the floating workspace open rule The open rule sized and centered every non-modal window on a floating workspace, including windows Hyprland already floats on its own: X11 popup and dropdown menus, tooltips, utility windows, transient and fixed-size windows. Menus then opened at app-window size, far from where they were clicked. Hyprland decides that floating before rules apply, so matching float = false leaves those windows at their own size. Co-Authored-By: Claude Opus 5.5 --- default/hypr/workspace-modes.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/default/hypr/workspace-modes.lua b/default/hypr/workspace-modes.lua index 9c77657be0b6..84b864c26d54 100644 --- a/default/hypr/workspace-modes.lua +++ b/default/hypr/workspace-modes.lua @@ -239,7 +239,11 @@ end -- size the mode gives it, so it pops in from its own middle the way a tiled -- window does, instead of opening tiled and shrinking into place. Modal -- dialogs, and apps with float rules of their own, float on their own account --- and are left to it, at their own size and outside the mode's claim. +-- and are left to it, at their own size and outside the mode's claim. So are +-- windows Hyprland floats before rules apply: X11 menus, tooltips, dialogs and +-- utility windows, transient and fixed-size windows, and Wayland child +-- toplevels. Sized and centered like an app window, a menu opens far from +-- where it was clicked. local function sync_open_rules() local ranges = floating_ranges() @@ -247,7 +251,7 @@ local function sync_open_rules() hl.window_rule({ name = OPEN_RULE .. i, enabled = true, - match = not_floating_on_their_own({ workspace = string.format("r[%d-%d]", range[1], range[2]), modal = false }), + match = not_floating_on_their_own({ workspace = string.format("r[%d-%d]", range[1], range[2]), modal = false, float = false }), float = true, size = OPEN_WIDTH .. " " .. OPEN_HEIGHT, move = open_position(), From 77c4e8cbdb9e04811c8883afe77b40a8dd8cf49c Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Tue, 17 Nov 2026 16:22:38 +0100 Subject: [PATCH 2/2] Claim windows the open rule floats before the rule lets go of them With float = false in its match, the open rule stops matching a window as soon as its own float = true effect floats it, and Hyprland drops the rule's omarchy-mode-opened tag before window.open fires. claim_opened then found no tag, the window went unclaimed, and it stayed floating when the workspace went back to tiling. window.open_early still carries the tag, so the claim moves there. Co-Authored-By: Claude Opus 5.5 --- default/hypr/workspace-modes.lua | 12 +++++++----- test/shell.d/hyprland-floating-workspaces-test.sh | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/default/hypr/workspace-modes.lua b/default/hypr/workspace-modes.lua index 84b864c26d54..522786d615b9 100644 --- a/default/hypr/workspace-modes.lua +++ b/default/hypr/workspace-modes.lua @@ -270,10 +270,11 @@ end -- exclusions current before their first window opens, including tag rules. o.floating_apps_changed = sync_open_rules --- A rule's tag leaves with the rule, so a window the open rule floated is --- claimed for good as it opens, and the mode tiles it again when it ends. A --- rule's tags are listed with a trailing "*", and a strict tag query passes --- them over, so the window's own list is read. +-- A rule's tag leaves with the rule, and the open rule stops matching a window +-- once it has floated it, so the window is claimed for good before it opens, +-- and the mode tiles it again when it ends. A rule's tags are listed with a +-- trailing "*", and a strict tag query passes them over, so the window's own +-- list is read. local function claim_opened(window) for _, tag in ipairs(window.tags or {}) do if tag == OPENED_TAG or tag == OPENED_TAG .. "*" then @@ -351,8 +352,9 @@ local function watch() input.follow_mouse = hl.get_config("input.follow_mouse") + hl.on("window.open_early", claim_opened) + hl.on("window.open", function(window) - claim_opened(window) unmaximize_others(window) arrange({ window }) end) diff --git a/test/shell.d/hyprland-floating-workspaces-test.sh b/test/shell.d/hyprland-floating-workspaces-test.sh index d53631c42e57..3aba0148cb1a 100755 --- a/test/shell.d/hyprland-floating-workspaces-test.sh +++ b/test/shell.d/hyprland-floating-workspaces-test.sh @@ -494,9 +494,10 @@ fi pass "a window leaving fullscreen on a floating workspace floats" # A window opening on a floating workspace floats from its first frame through -# a window rule, which tags it the way rules do, with a trailing "*". The mode -# claims it as it opens, so it tiles again when the workspace stops floating, -# and the rule stops applying. +# a window rule, which tags it the way rules do, with a trailing "*". The rule +# stops matching the window it floated, so its tag is gone by window.open: the +# mode claims it before then, so it tiles again when the workspace stops +# floating, and the rule stops applying. printf 'o.workspace_mode({ workspace = "1", mode = "floating" })\n' >"$modes_dir/1.lua" if ! run_lua ' require("default.hypr.workspace-layouts") @@ -511,6 +512,8 @@ local rule = open_rule() assert(rule and rule.float and rule.enabled and rule.match.workspace == "r[1-1]", "no open rule floats windows on the floating workspace") local first_position = rule.move local opened = window("0x1", 1, { floating = true, tags = { "omarchy-mode-opened*" } }) +state().subscriptions["window.open_early"][1](opened) +table.remove(opened.tags, 1) state().subscriptions["window.open"][1](opened) assert(has_tag(opened, "omarchy-mode-floated"), "a window the open rule floated was not claimed by the mode") assert(open_rule().move ~= first_position, "the next window opens exactly on top of the last")