Refactoring
This commit is contained in:
+15
-13
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user