summaryrefslogtreecommitdiff
path: root/workspace.lua
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-12-02 17:51:29 +0100
committerAnton Khirnov <anton@khirnov.net>2020-12-02 17:51:29 +0100
commit9d9fabb0121ec288f4dc033275909ff278e696e6 (patch)
tree50bd8b88bc631aae4c482201b8029d6b836d980c /workspace.lua
parent5a1465b5c97d457591e154cd3de04113b6166ccc (diff)
workspace: pre-create desktops
Allows them to be used before they are viewed (e.g. when clients are sent to them).
Diffstat (limited to 'workspace.lua')
-rw-r--r--workspace.lua11
1 files 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