3
3
-- end)
4
4
5
5
-- half left
6
+ rightjust = 0
7
+ leftjust = 0
8
+ centered = 0
6
9
hs .hotkey .bind ({" alt" }, " h" , function ()
7
10
local win = hs .window .focusedWindow ()
8
11
local f = win :frame ()
9
12
local screen = win :screen ()
10
13
local max = screen :frame ()
11
14
12
- f .x = max .x
13
- f .y = max .y
14
- f .w = max .w / 2
15
- f .h = max .h
15
+ if leftjust == 0 then
16
+ f .x = max .x
17
+ f .y = max .y
18
+ f .w = max .w / 2
19
+ f .h = max .h
20
+ elseif leftjust == 1 then
21
+ f .x = max .x
22
+ f .y = max .y
23
+ f .w = max .w / 2
24
+ f .h = max .h / 2
25
+ elseif leftjust == 2 then
26
+ f .x = max .x
27
+ f .y = max .y + (max .h / 2 )
28
+ f .w = max .w / 2
29
+ f .h = max .h / 2
30
+ end
31
+ rightjust = 0
32
+ centered = 0
16
33
win :setFrame (f )
34
+ leftjust = (leftjust + 1 ) % 3
17
35
end )
18
36
19
37
-- half right
@@ -23,11 +41,26 @@ hs.hotkey.bind({"alt"}, "l", function()
23
41
local screen = win :screen ()
24
42
local max = screen :frame ()
25
43
26
- f .x = max .x + (max .w / 2 )
27
- f .y = max .y
28
- f .w = max .w / 2
29
- f .h = max .h
44
+ if rightjust == 0 then
45
+ f .x = max .x + (max .w / 2 )
46
+ f .y = max .y
47
+ f .w = max .w / 2
48
+ f .h = max .h
49
+ elseif rightjust == 1 then
50
+ f .x = max .x + (max .w / 2 )
51
+ f .y = max .y
52
+ f .w = max .w / 2
53
+ f .h = max .h / 2
54
+ elseif rightjust == 2 then
55
+ f .x = max .x + (max .w / 2 )
56
+ f .y = max .y + (max .h / 2 )
57
+ f .w = max .w / 2
58
+ f .h = max .h / 2
59
+ end
60
+ leftjust = 0
61
+ centered = 0
30
62
win :setFrame (f )
63
+ rightjust = (rightjust + 1 ) % 3
31
64
end )
32
65
33
66
-- maximise
@@ -45,7 +78,6 @@ hs.hotkey.bind({"alt"}, "m", function()
45
78
end )
46
79
47
80
-- center
48
- centered = 0
49
81
hs .hotkey .bind ({" alt" }, " c" , function ()
50
82
local win = hs .window .focusedWindow ()
51
83
local f = win :frame ()
@@ -63,6 +95,8 @@ hs.hotkey.bind({"alt"}, "c", function()
63
95
f .w = max .w / 2
64
96
f .h = max .h / 2
65
97
end
98
+ leftjust = 0
99
+ rightjust = 0
66
100
win :setFrame (f )
67
101
centered = (centered + 1 ) % 2
68
102
end )
0 commit comments