summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-04-08 17:20:40 +0200
committerAnton Khirnov <anton@khirnov.net>2020-04-08 17:20:40 +0200
commit5177d3eab6276fefc846d730a6f64065d1aeedd0 (patch)
treeb9277af8358c72ca11266ec2739771cbfe41da15
parent6a5e3dd3ba90bb775fda96c48debb60fc128a901 (diff)
workspace: add desktops automatically
-rw-r--r--bindings.lua3
-rw-r--r--rc.lua14
-rw-r--r--workspace.lua4
3 files changed, 9 insertions, 12 deletions
diff --git a/bindings.lua b/bindings.lua
index 8b3a6eb..73226ca 100644
--- a/bindings.lua
+++ b/bindings.lua
@@ -130,9 +130,6 @@ function M.create(workspace)
awful.key({ modkey }, "#" .. i + 66,
function ()
local screen = mouse.screen
- if workspace.desktops[i] == nil then
- workspace:add_desktop(i, "Desktop " .. i, 10)
- end
workspace:view(screen, i)
end),
-- Move client to tag.
diff --git a/rc.lua b/rc.lua
index ae145bf..2910233 100644
--- a/rc.lua
+++ b/rc.lua
@@ -52,14 +52,6 @@ local layouts =
}
-- }}}
--- {{{ Tags
-local wsp = workspace.Workspace:new(layouts)
-for s in screen do
- wsp:add_desktop(s.index, "Desktop " .. s.index, 10)
- wsp:view(s, s.index, 1)
-end
--- }}}
-
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
@@ -72,7 +64,11 @@ mytextclock = wibox.widget.textclock()
mywibox = {}
mypromptbox = {}
+local wsp = workspace.Workspace:new(layouts)
+
for s in screen do
+ wsp:view(s, s.index, 1)
+
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
@@ -86,7 +82,7 @@ for s in screen do
-- Create a tasklist widget
local pgr = pager.Pager:new(s, 128, 800)
- pgr:set_desktop(wsp.desktops[1])
+ pgr:set_desktop(wsp.desktops[s.index])
wsp.signals:connect_signal("desktop:view",
function(signals, view_screen, desktop)
diff --git a/workspace.lua b/workspace.lua
index 9337ec2..ad985df 100644
--- a/workspace.lua
+++ b/workspace.lua
@@ -48,6 +48,10 @@ function Workspace:_apply_state()
end
function Workspace:view(screen, desktop, page_idx)
+ if self.desktops[desktop] == nil then
+ print("Adding desktop " .. desktop)
+ self:add_desktop(desktop, "Desktop " .. desktop, 10)
+ end
print("workspace: " .. screen.index .. ": view " .. desktop .. "/" .. (page_idx or "nil"))
-- the page currently displayed on the target screen
local old = {}