39 lines
1.2 KiB
Lua
39 lines
1.2 KiB
Lua
-- Per-monitor persistent workspaces + switching binds.
|
|
-- See https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/
|
|
|
|
local mainMod = "SUPER"
|
|
|
|
-- workspace id -> monitor assignment
|
|
local workspaces = {
|
|
{ id = 1, monitor = "DP-1", default = true },
|
|
{ id = 2, monitor = "DP-1" },
|
|
{ id = 3, monitor = "DP-1" },
|
|
{ id = 4, monitor = "DP-2", default = true },
|
|
{ id = 5, monitor = "DP-2" },
|
|
{ id = 6, monitor = "DP-2" },
|
|
{ id = 7, monitor = "HDMI-A-2" },
|
|
{ id = 8, monitor = "HDMI-A-2" },
|
|
{ id = 9, monitor = "HDMI-A-2", default = true },
|
|
{ id = 10, monitor = "HDMI-A-1", default = true },
|
|
}
|
|
|
|
for _, ws in ipairs(workspaces) do
|
|
hl.workspace_rule({
|
|
workspace = tostring(ws.id),
|
|
monitor = ws.monitor,
|
|
persistent = true,
|
|
default = ws.default,
|
|
})
|
|
|
|
local key = ws.id % 10 -- 10 maps to key 0
|
|
|
|
-- Focus the monitor, then switch to the workspace on it
|
|
hl.bind(mainMod .. " + " .. key, function()
|
|
hl.dispatch(hl.dsp.focus({ monitor = ws.monitor }))
|
|
hl.dispatch(hl.dsp.focus({ workspace = ws.id }))
|
|
end)
|
|
|
|
-- Move the active window to the workspace silently (don't follow)
|
|
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = ws.id, follow = false }))
|
|
end
|