-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
80 lines (65 loc) · 1.63 KB
/
init.lua
File metadata and controls
80 lines (65 loc) · 1.63 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
local awful = require("awful")
local capi = {
screen = screen,
}
local infinite = {
screen = {},
tags = {},
}
local shelf = capi.screen.fake_add(
-capi.screen[1].geometry.width, -capi.screen[1].geometry.height,
capi.screen[1].geometry.width, capi.screen[1].geometry.height
)
function infinite.screen.get(index)
return capi.screen[index] or shelf
end
local function move(taglist)
return {
to = function (screen)
for _, tag in ipairs (taglist) do
tag.screen = screen
end
end,
}
end
function infinite.screen.activate(taglist)
local screen = awful.screen.focused()
move(screen.tags).to(shelf)
move(taglist).to(screen)
end
local function from(taglist)
return {
get_selected_or_first = function ()
for _, tag in ipairs (taglist) do
if tag.selected then
return tag
end
end
return taglist[0]
end,
}
end
-- infinite.tags.move(client).to(taglist)
function infinite.tags.move(client)
return {
to = function (taglist)
local tag = from(taglist).get_selected_or_first()
client:move_to_tag(tag)
end,
}
end
-- infinite.screen.move(client).around()
function infinite.screen.move(client)
return {
around = function ()
client:move_to_screen()
if client.screen == shelf then
client:move_to_screen()
end
end,
}
end
setmetatable (infinite.screen, {
__call = function (_, index) return infinite.screen.get(index) end,
})
return infinite