blob: d714dc9dcc1c10442a24657a2a8b18aa94145cc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
local M = {}
local awful = require("awful")
local object = require("gears.object")
local function desktop_show(self, screen, page_idx)
if page_idx == nil then
page_hist = self.page_history[screen]
if page_hist ~= nil then
page_idx = page_hist
else
page_idx = 1
end
end
page = self.pages[page_idx]
if page then
self.page_history[screen] = page_idx
end
return page_idx
end
local function desktop_new(idx, name, nb_pages, layout)
local ret = object()
ret:add_signal("page:view")
ret.show = desktop_show
ret.name = name
ret.pages = {}
for i = 1, nb_pages do
ret.pages[i] = awful.tag.add(name .. i, { layout = layout })
end
-- page_history[i] is the last page viewed on screen i
ret.page_history = {}
return ret
end
M.new = desktop_new
return M
|