Refactoring

This commit is contained in:
2026-09-30 17:03:12 +01:00
parent 657851bc02
commit 9b7e3507d8
9 changed files with 198 additions and 93 deletions
+15 -13
View File
@@ -85,24 +85,26 @@ hl.on('config.reloaded', setup_monitors)
hl.bind('switch:off:Lid Switch', setup_monitors)
hl.bind('switch:on:Lid Switch', setup_monitors)
function set_laptop_workspace_to_monocle()
local workspace = get_active_workspace()
local function set_laptop_workspaces_to_monocle()
local workspaces = hl.get_workspaces()
if not workspace then
return
end
if is_laptop_screen_focused() then
hl.workspace_rule {
workspace = 'name:' .. tostring(workspace.name),
layout = 'monocle',
}
for i = 1, #workspaces do
local workspace = workspaces[i]
if
workspace.monitor
and workspace.monitor.description == LAPTOP_MONITOR_NAME
then
hl.workspace_rule {
workspace = 'name:' .. tostring(workspace.name),
layout = 'monocle',
}
end
end
end
hl.on('monitor.focused', set_laptop_workspace_to_monocle)
hl.on('monitor.focused', set_laptop_workspaces_to_monocle)
hl.on('config.reloaded', set_laptop_workspace_to_monocle)
hl.on('config.reloaded', set_laptop_workspaces_to_monocle)
hl.on('window.open', function()
local windows = hl.get_windows()