-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid.lua
executable file
·81 lines (77 loc) · 2.13 KB
/
grid.lua
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
80
81
-----------------------------------------------------------------------------------
-- File: grid.lua
-- Author: Joaquín Cuitiño
-- License: MIT
-----------------------------------------------------------------------------------
-- To easily layout windows on the screen, we use hs.grid to create a 6x6 grid.
local GRID_SIZE = 18
local HALF_GRID_SIZE = GRID_SIZE / 2
-- Set the grid size and configure margins.
-- Also, don"t animate window changes... That"s too slow.
hs.grid.setGrid(GRID_SIZE .. "x" .. GRID_SIZE)
hs.grid.setMargins({0, 0})
hs.window.animationDuration = 0
-- Define useful pre-defined positions for the grid.
local p = {
left = {
x = 0, y = 0,
w = HALF_GRID_SIZE, h = GRID_SIZE
},
right = {
x = HALF_GRID_SIZE, y = 0,
w = HALF_GRID_SIZE, h = GRID_SIZE
},
top = {
x = 0, y = 0,
w = GRID_SIZE, h = HALF_GRID_SIZE
},
bottom = {
x = 0, y = HALF_GRID_SIZE,
w = GRID_SIZE, h = HALF_GRID_SIZE
},
topLeft = {
x = 0, y = 0,
w = HALF_GRID_SIZE, h = HALF_GRID_SIZE
},
topRight = {
x = HALF_GRID_SIZE, y = 0,
w = HALF_GRID_SIZE, h = HALF_GRID_SIZE
},
bottomLeft = {
x = 0, y = HALF_GRID_SIZE,
w = HALF_GRID_SIZE, h = HALF_GRID_SIZE
},
bottomRight = {
x = HALF_GRID_SIZE, y = HALF_GRID_SIZE,
w = HALF_GRID_SIZE, h = HALF_GRID_SIZE
},
max = {
x = 0, y = 0,
w = GRID_SIZE, h = GRID_SIZE
},
centerStage_bottomLeft = {
x = 0, y = HALF_GRID_SIZE,
w = 6, h = HALF_GRID_SIZE
},
centerStage_bottomLeftSidecar = {
x = 6, y = HALF_GRID_SIZE,
w = 6, h = HALF_GRID_SIZE
},
centerStage_topLeft = {
x = 0, y = 0,
w = 6, h = HALF_GRID_SIZE
},
centerStage_bottomRight = {
x = 12, y = HALF_GRID_SIZE,
w = 6, h = HALF_GRID_SIZE
},
centerStage_topRight = {
x = 12, y = 0,
w = 6, h = HALF_GRID_SIZE
},
centerStage = {
x = 6, y = 0,
w = 6, h = GRID_SIZE
},
}
return p