Repository navigation
Per-monitor workspaces: add an opt-out for global workspace numbers #17647
Replies: 16 comments
|
Same here. I have asked Claude to get this back: -- file: $HOME/.config/hypr/global-workspaces.lua
-- Global workspaces 1-10 shared by every monitor, as before Omarchy 4.5.
--
-- Omarchy gives each monitor its own block of ten workspaces (see
-- $OMARCHY_PATH/default/hypr/monitor-workspaces.lua) and renumbers workspaces into
-- those blocks on every start, config reload and monitor plug. That fights the
-- workspace rules in monitors.lua, which pin each number to a monitor so an app
-- keeps its workspace whichever monitor it is on.
--
-- This swaps the module's actions on `o.workspaces` for plain global ones and
-- turns its reconciling into a no-op. The bar dispatches `o.workspaces.focus(...)`
-- by name, so it picks up the replacement too; the default keys captured the old
-- actions when they were bound, so they are bound again here.
--
-- Must be required after default.hypr.omarchy.
local paths = require("default.hypr.paths")
local ws = o.workspaces
-- The bar labels each monitor with the block this file assigns it. Without the
-- file it falls back to the block of the workspace shown, which is always the
-- first one here, so every bar lists the same workspaces 1-10.
os.remove(paths.state_home .. "/omarchy/monitor-workspaces")
local function action(fn, expression)
o.bind_expressions[fn] = expression
return fn
end
function ws.reconcile() end
function ws.workspace_id(_, slot)
return slot
end
-- The bar passes its monitor's name as a second argument; a global workspace
-- lives wherever its rule or Hyprland puts it, so it is ignored.
function ws.focus(slot)
return action(function()
hl.dispatch(hl.dsp.focus({ workspace = tostring(slot) }))
end, "o.workspaces.focus(" .. slot .. ")")
end
function ws.move_window(slot, follow)
return action(function()
local window = hl.get_active_window()
if window then
hl.dispatch(hl.dsp.window.move({ workspace = tostring(slot), follow = follow ~= false, window = "address:" .. window.address }))
end
end, "o.workspaces.move_window(" .. slot .. (follow == false and ", false" or "") .. ")")
end
function ws.move_to_monitor(direction)
return action(function()
local target = hl.get_monitor(direction)
if target then
hl.dispatch(hl.dsp.workspace.move({ monitor = target.name }))
end
end, "o.workspaces.move_to_monitor(\"" .. direction .. "\")")
end
for slot = 1, 10 do
local key = "code:" .. tostring(slot + 9)
o.rebind("SUPER + " .. key, "Switch to workspace " .. slot, ws.focus(slot))
o.rebind("SUPER + SHIFT + " .. key, "Move window to workspace " .. slot, ws.move_window(slot))
o.rebind("SUPER + SHIFT + ALT + " .. key, "Move window silently to workspace " .. slot, ws.move_window(slot, false))
end
local directions = { LEFT = "l", RIGHT = "r", UP = "u", DOWN = "d" }
for key, direction in pairs(directions) do
o.rebind("SUPER + SHIFT + ALT + " .. key, "Move workspace to " .. key:lower() .. " monitor", ws.move_to_monitor(direction))
end |
|
+1, same situation here (Omarchy 4.5.0, laptop eDP-1 + external HDMI-A-1). Before 4.5 my workflow was plain global workspaces: Super+N went to workspace N, and a new workspace opened on whichever monitor had focus. After the update, the reconciler renumbered my existing workspaces into per-monitor blocks (1 → 11, 3 → 13 on the external), which also left my cloned My current workaround, in |
|
+1 |
|
+1. Same here on a desktop with three fixed monitors (Omarchy 4.5.0, Hyprland 0.56.2). Per-monitor blocks make sense for laptops that dock and undock. But on fixed screens nothing ever gets unplugged, and Two more side effects we hit on top of the ones already reported:
Workaround without patching internal functions: register a replacement under the module's name in package.preload["default.hypr.monitor-workspaces"] = function() return require("hypr.global-workspaces") end
local M = { slots = 10 }
local function action(fn, expression)
o.bind_expressions[fn] = expression
return fn
end
function M.workspace_id(_, slot) return slot end
function M.reconcile() end
function M.focus(slot)
return action(function()
hl.dispatch(hl.dsp.focus({ workspace = tostring(slot) }))
end, "o.workspaces.focus(" .. slot .. ")")
end
function M.move_window(slot, follow)
return action(function()
local window = hl.get_active_window()
if window then
hl.dispatch(hl.dsp.window.move({ workspace = tostring(slot), follow = follow ~= false, window = "address:" .. window.address }))
end
end, "o.workspaces.move_window(" .. slot .. (follow == false and ", false" or "") .. ")")
end
function M.move_to_monitor(direction)
return action(function()
local target = hl.get_monitor(direction)
if target then hl.dispatch(hl.dsp.workspace.move({ monitor = target.name })) end
end, "o.workspaces.move_to_monitor(\"" .. direction .. "\")")
end
function M.move_window_to_monitor(direction)
return action(function()
local target = hl.get_monitor(direction)
if target then hl.dispatch(hl.dsp.window.move({ monitor = target.name })) end
end, "o.workspaces.move_window_to_monitor(\"" .. direction .. "\")")
end
o.workspaces = M
return MFor the bar, clone
Note that plugin hot reload didn't pick up edits to the clone; it took an This still depends on the module's API staying stable, so an official switch would be much safer. Something like |
|
Oh, I'll wait upgrading to 4.5 then! My setup is:
Working on a desktop btw. |
|
I created a PR that lets you toggle between per-monitor and global workspaces: #17868 |
|
+1 |
|
+1 for an official opt-out, and in support of #17868. My setup is a desktop with two fixed monitors (one in portrait). Before 4.5 I pinned workspaces 1–3 to the portrait monitor and 4–10 to the main one with After updating from 4.0.6 to 4.5.0, those rules started fighting the per-monitor module. Super+1–3 on the portrait monitor went to 11–13, and every config reload renumbered workspaces into the per-monitor blocks (1 → 11 on the portrait monitor). Apps kept changing numbers, and some keys sent focus to the other screen. Nothing in the update warned that existing workspace pins would conflict. For now I've gone back to global workspaces locally. I register a replacement for Per-monitor blocks make sense for laptops that dock and undock, but on a fixed multi-monitor desktop, global numbers are the point. |
|
+1 |
|
+1 It would be very nice to have the option to go back 🙂 since all the attention Omarchy is getting, changes like this can affect a lot of people and I would prefer not having to maintain my local fork |
|
+1 for an official opt-out, and in support of #17868. Desktop with two fixed monitors (Omarchy 4.5.0-3): workspaces 1–5 pinned to the main display and 6–10 to the second with After the update, the reconciler moved my workspaces 6 and 7 onto the main display and renumbered another to 18. Current workaround: |
|
+1 |
|
+1, and support for #17868. Desktop with three fixed monitors (Omarchy 4.5.0-3): workspaces 1/4 pinned to the left display, 2/5 to the middle, 3/6 to the right with 4.5 broke all of that with no warning. On first login, Getting it back meant three workarounds: turning |
|
+1 |
|
+1 I dunno, the odd numbers / even numbers thing just maps out well in my head, and I can send things exactly where I want them with one Super+Shift+n. |
|
+1 I had odd numbers on my left monitor, even numbers on my right monitor, I'm puzzled as to why they would remove the ability to quickly switch focus and send windows between monitors with this change |
Uh oh!
There was an error while loading. Please reload this page.
Since 4.5, each monitor has its own workspaces 1–10 (default/hypr/monitor-workspaces.lua). That breaks a common laptop + external monitor workflow, and there's no setting to go back.
How I work
So switching between screens is one key press with the left hand on the home row.
What changed
Super+N now means "workspace N on whichever monitor has focus." The same key goes to a different place depending on where focus happens to be. To get from Brave to my laptop terminal I now press Ctrl+Alt+Tab to change monitor first, and that's a big hand stretch. Knowing an app's number is no longer enough to reach it.
Suggestion
Add a flag in hyprland.lua, like the existing omarchy_default_bindings:
omarchy_per_monitor_workspaces = false
When it's off, the per-monitor module shouldn't load, and the bindings and bar should use global workspace numbers like before 4.5. A way to pin workspaces to monitors would also help, such as a hl.workspace_rule({ workspace = "1", monitor = "eDP-1" }) example in monitors.lua.
Current workaround
I override o.workspaces.focus, move_window, move_to_monitor and reconcile. I also rebind Super+1–0 and delete ~/.local/state/omarchy/monitor-workspaces so the bar stops splitting workspaces per monitor. It works, but it relies on Omarchy's internal functions, so the next update could break it. An official opt-out would be much safer.
Omarchy 4.5.0, Hyprland 0.56.2, laptop eDP-1 + external DP-1.
All reactions