From 9d9fabb0121ec288f4dc033275909ff278e696e6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 Dec 2020 17:51:29 +0100 Subject: workspace: pre-create desktops Allows them to be used before they are viewed (e.g. when clients are sent to them). --- workspace.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/workspace.lua b/workspace.lua index bfdc02e..fb632db 100644 --- a/workspace.lua +++ b/workspace.lua @@ -17,7 +17,7 @@ local function desk_find_empty_page(desk) return nil end -function Workspace:add_desktop(idx, name, nb_pages) +function Workspace:_add_desktop(idx, name, nb_pages) local desk = object() desk.name = name @@ -77,11 +77,6 @@ end function Workspace:view(screen, desktop_idx, page_idx) print("workspace: " .. screen.index .. ": view " .. desktop_idx .. "/" .. (page_idx or "nil")) - if self.desktops[desktop_idx] == nil then - print("Adding desktop " .. desktop_idx) - self:add_desktop(desktop_idx, "Desktop " .. desktop_idx, 10) - end - local desktop = self.desktops[desktop_idx] -- the current state of the target screen @@ -189,6 +184,10 @@ function Workspace:new(layouts) o.signals = object() + for i = 1, 12 do + o:_add_desktop(i, "Desktop " .. i, 10) + end + return o end -- cgit v1.2.3