-
Notifications
You must be signed in to change notification settings - Fork 0
/
.phoenix.js
66 lines (56 loc) · 2.11 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const MAXIMIZED_APPS = ['com.googlecode.iterm2', 'org.mozilla.firefox'];
Event.on('windowDidOpen', function(window) {
if (
MAXIMIZED_APPS.includes(window.app().bundleIdentifier()) &&
(window.isMain() || window.isNormal())
) {
window.maximize();
}
});
const WINDOW_MOD = ['ctrl', 'alt'];
const WINDOW_MOD_S = [...WINDOW_MOD, 'shift'];
// Maximize
const MAXIMIZE_HANDLER = new Key('up', WINDOW_MOD, function() {
const screenRect = Screen.main().visibleFrame();
Window.focused().setFrame(screenRect);
});
// Move focused window to the left half
const LEFT_HALF_HANDLER = new Key('left', WINDOW_MOD, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.width /= 2;
Window.focused().setFrame(screenRect);
});
// Move focused window to the right half
const RIGHT_HALF_HANDLER = new Key('right', WINDOW_MOD, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.x = screenRect.width / 2;
screenRect.width -= screenRect.x;
Window.focused().setFrame(screenRect);
});
// Move focused window to the left third
const LEFT_THIRD_HANDLER = new Key('left', WINDOW_MOD_S, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.width /= 3;
Window.focused().setFrame(screenRect);
});
// Move focused window to the right third
const RIGHT_THIRD_HANDLER = new Key('right', WINDOW_MOD_S, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.x = screenRect.width - screenRect.width / 3;
screenRect.width -= screenRect.x;
Window.focused().setFrame(screenRect);
});
// Move focused window to the left 2 thirds
const LEFT_2_THIRDS_HANDLER = new Key('home', WINDOW_MOD_S, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.width -= screenRect.width / 3;
Window.focused().setFrame(screenRect);
});
// Move focused window to the right 2 thirds
const RIGHT_2_THIRDS_HANDLER = new Key('end', WINDOW_MOD_S, function() {
const screenRect = Screen.main().visibleFrame();
screenRect.x = screenRect.width / 3;
screenRect.width -= screenRect.x;
Window.focused().setFrame(screenRect);
});
Phoenix.set({ openAtLogin: true });