Workspaces

This commit is contained in:
2026-06-27 19:38:20 +01:00
parent de178fa25a
commit 0b589161ff
2 changed files with 26 additions and 30 deletions
+12 -7
View File
@@ -22,19 +22,23 @@ local function setup_monitors()
for i = 1, 5 do
for j = monitor_count, 1, -1 do
local monitor = monitors[j]
local workspace_id = "name:" .. workspace_map[i] .. "_" .. j
hl.notification.create({ text = workspace_id, duration = 2000 })
-- local workspace_id = "name:" .. workspace_map[i] .. "_" .. j
local workspace_id = (i - 1) * monitor_count + j
local workspace_name = workspace_map[i] .. "_" .. j
hl.workspace_rule({
workspace = tostring(workspace_id),
workspace = workspace_id,
default_name = workspace_name,
monitor = monitor.name,
default = i == 1,
})
table.insert(
monitor_binds,
hl.bind("SUPER + code:1" .. (i - 1), function()
hl.dsp.focus({ workspace = workspace_id })
hl.notification.create({ text = workspace_id, duration = 2000 })
end, { description = "Switch to workspace " .. workspace_map[i] })
hl.bind(
"SUPER + code:1" .. (i - 1),
hl.dsp.focus({ workspace = "name:" .. workspace_name }),
{ description = "Switch to workspace " .. workspace_map[i] }
)
)
end
@@ -45,6 +49,7 @@ local function setup_monitors()
local active_workspace_name = active_workspace.name
local monitor_suffix = active_workspace_name:match("_(%d+)$") or "1"
local new_workspace = "name:" .. workspace_map[i] .. "_" .. monitor_suffix
-- local new_workspace = (i - 1) * monitor_count + active_workspace.id
hl.notification.create({ text = new_workspace, duration = 2000 })
hl.dispatch(hl.dsp.window.move({ workspace = new_workspace, follow = false }))
end, { description = "Move window to workspace " .. workspace_map[i] })