1 | -- Set grids to use for different size screens |
---|
2 | hs.grid.setGrid('2x2', '1920x1080') |
---|
3 | hs.grid.setGrid('4x4', '3840x2160') |
---|
4 | |
---|
5 | -- Snap window |
---|
6 | hs.hotkey.bind({"cmd"}, "Return", function() |
---|
7 | local win = hs.window.focusedWindow() |
---|
8 | hs.grid.snap(win) |
---|
9 | end) |
---|
10 | |
---|
11 | -- Move window |
---|
12 | hs.hotkey.bind({"cmd"}, "Left", function() |
---|
13 | local win = hs.window.focusedWindow() |
---|
14 | hs.grid.snap(win) |
---|
15 | hs.grid.pushWindowLeft(win) |
---|
16 | end) |
---|
17 | |
---|
18 | hs.hotkey.bind({"cmd"}, "Right", function() |
---|
19 | local win = hs.window.focusedWindow() |
---|
20 | hs.grid.snap(win) |
---|
21 | hs.grid.pushWindowRight(win) |
---|
22 | end) |
---|
23 | |
---|
24 | hs.hotkey.bind({"cmd"}, "Up", function() |
---|
25 | local win = hs.window.focusedWindow() |
---|
26 | hs.grid.snap(win) |
---|
27 | hs.grid.pushWindowUp(win) |
---|
28 | end) |
---|
29 | |
---|
30 | hs.hotkey.bind({"cmd"}, "Down", function() |
---|
31 | local win = hs.window.focusedWindow() |
---|
32 | hs.grid.snap(win) |
---|
33 | hs.grid.pushWindowDown(win) |
---|
34 | end) |
---|
35 | |
---|
36 | -- Grow window |
---|
37 | hs.hotkey.bind({"cmd", "ctrl"}, "Left", function() |
---|
38 | local win = hs.window.focusedWindow() |
---|
39 | hs.grid.snap(win) |
---|
40 | hs.grid.pushWindowLeft(win) |
---|
41 | hs.grid.resizeWindowWider(win) |
---|
42 | end) |
---|
43 | |
---|
44 | hs.hotkey.bind({"cmd", "ctrl"}, "Right", function() |
---|
45 | local win = hs.window.focusedWindow() |
---|
46 | hs.grid.snap(win) |
---|
47 | hs.grid.resizeWindowWider(win) |
---|
48 | end) |
---|
49 | |
---|
50 | hs.hotkey.bind({"cmd", "ctrl"}, "Up", function() |
---|
51 | local win = hs.window.focusedWindow() |
---|
52 | hs.grid.snap(win) |
---|
53 | hs.grid.pushWindowUp(win) |
---|
54 | hs.grid.resizeWindowTaller(win) |
---|
55 | end) |
---|
56 | |
---|
57 | hs.hotkey.bind({"cmd", "ctrl"}, "Down", function() |
---|
58 | local win = hs.window.focusedWindow() |
---|
59 | hs.grid.snap(win) |
---|
60 | hs.grid.resizeWindowTaller(win) |
---|
61 | end) |
---|
62 | |
---|
63 | -- Shrink window |
---|
64 | hs.hotkey.bind({"cmd", "shift"}, "Left", function() |
---|
65 | local win = hs.window.focusedWindow() |
---|
66 | hs.grid.snap(win) |
---|
67 | hs.grid.resizeWindowThinner(win) |
---|
68 | end) |
---|
69 | |
---|
70 | hs.hotkey.bind({"cmd", "shift"}, "Right", function() |
---|
71 | local win = hs.window.focusedWindow() |
---|
72 | hs.grid.snap(win) |
---|
73 | hs.grid.resizeWindowThinner(win) |
---|
74 | hs.grid.pushWindowRight(win) |
---|
75 | end) |
---|
76 | |
---|
77 | hs.hotkey.bind({"cmd", "shift"}, "Up", function() |
---|
78 | local win = hs.window.focusedWindow() |
---|
79 | hs.grid.snap(win) |
---|
80 | hs.grid.resizeWindowShorter(win) |
---|
81 | end) |
---|
82 | |
---|
83 | hs.hotkey.bind({"cmd", "shift"}, "Down", function() |
---|
84 | local win = hs.window.focusedWindow() |
---|
85 | hs.grid.snap(win) |
---|
86 | hs.grid.resizeWindowShorter(win) |
---|
87 | hs.grid.pushWindowDown(win) |
---|
88 | end) |
---|
89 | |
---|
90 | |
---|