-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphoenix.js
49 lines (40 loc) · 1.36 KB
/
phoenix.js
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
function moveWindow(rect, screen) {
screen = screen || Screen.main();
const scr = screen.visibleFrameInRectangle();
Window.focused().setFrame({
x: Math.round(scr.x + rect.x * scr.width),
y: Math.round(scr.y + rect.y * scr.height),
width: Math.round(scr.width * rect.width),
height: Math.round(scr.height * rect.height),
});
}
// Halves
Key.on("h", ["cmd", "control", "shift"], () => {
moveWindow({ x: 0, y: 0, width: 0.5, heigh: 1.0 });
});
Key.on("l", ["cmd", "control", "shift"], () => {
moveWindow({ x: 0.5, y: 0, width: 0.5, heigh: 1.0 });
});
Key.on("c", ["cmd", "control", "shift"], () => {
moveWindow({ x: 0.25, y: 0, width: 0.5, heigh: 1.0 });
});
// Thirds
Key.on("d", ["cmd", "control", "shift"], () => {
moveWindow({ x: 0, y: 0, width: 1 / 3, heigh: 1.0 });
});
Key.on("f", ["cmd", "control", "shift"], () => {
moveWindow({ x: 1 / 3, y: 0, width: 1 / 3, heigh: 1.0 });
});
Key.on("g", ["cmd", "control", "shift"], () => {
moveWindow({ x: 2 / 3, y: 0, width: 1 / 3, heigh: 1.0 });
});
// Two Thirds
Key.on("e", ["cmd", "control", "shift"], () => {
moveWindow({ x: 0, y: 0, width: 2 / 3, heigh: 1.0 });
});
Key.on("t", ["cmd", "control", "shift"], () => {
moveWindow({ x: 1 / 3, y: 0, width: 2 / 3, heigh: 1.0 });
});
Key.on("r", ["cmd", "control", "shift"], () => {
moveWindow({ x: 1 / 6, y: 0, width: 2 / 3, heigh: 1.0 });
});