-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphoenix.js
64 lines (51 loc) · 1.8 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
/* globals api, Window */
/* jshint curly:false */
var debugMode = true;
function debug( message ) {
if ( debugMode ) api.alert( message );
}
/***********************************************
* BINDINGS
***********************************************/
debugMode = false;
var simpleMods = ['alt', 'cmd'];
var preciseMods = ['ctrl', 'cmd', 'alt'];
var preciseAdjustment = 30;
api.bind( 'f', simpleMods, function() {
debug( 'Maximizing current window' );
Window.focusedWindow().maximize();
} );
api.bind( 'left', simpleMods, function() {
debug( 'Moving to left-half' );
var win = Window.focusedWindow(),
screenFrame = win.screen().frameWithoutDockOrMenu();
win.setFrame( {x: screenFrame.x, y: screenFrame.y, width: screenFrame.width / 2, height: screenFrame.height} );
} );
api.bind( 'right', simpleMods, function() {
debug( 'Moving to right-half' );
var win = Window.focusedWindow(),
screenFrame = win.screen().frameWithoutDockOrMenu();
win.setFrame( {x: (screenFrame.x + screenFrame.width / 2), y: screenFrame.y, width: screenFrame.width / 2, height: screenFrame.height} );
} );
api.bind( 'right', preciseMods, function() {
debug( 'Increasing size to the right' );
var win = Window.focusedWindow(),
screenFrame = win.screen().frameWithoutDockOrMenu();
win.setFrame( {
x: win.topLeft().x,
y: win.topLeft().y,
width: win.size().width + ( screenFrame.width / preciseAdjustment ),
height: win.size().height
} );
} );
api.bind( 'left', preciseMods, function() {
debug( 'Increasing size to the left' );
var win = Window.focusedWindow(),
screenFrame = win.screen().frameWithoutDockOrMenu();
win.setFrame( {
x: win.topLeft().x - ( screenFrame.width / preciseAdjustment ),
y: win.topLeft().y,
width: win.size().width + ( screenFrame.width / preciseAdjustment ),
height: win.size().height
} );
} );