-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslate.js
50 lines (40 loc) · 1.84 KB
/
slate.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
/* 'hyper' is what my Caps Lock key is set to thanks to a few websites, but the simplest walkthrough is below.
* It basically opens up every key for a custom command.
* http://www.leancrew.com/all-this/2012/11/shift-control-option-command-on-caps-lock/ */
var hyper = ':ctrl;shift;alt;cmd';
//Configs
S.cfga({
"defaultToCurrentScreen" : true,
"secondsBetweenRepeat" : 0.1,
"checkDefaultsOnLoad" : true,
"focusCheckWidthMax" : 3000,
"orderScreensLeftToRight" : true
});
var bindings = {};
bindings["right" + hyper] = S.op("push", { "direction" : "right", "style" : "bar-resize:screenSizeX/2" });
bindings["left" + hyper] = S.op("push", { "direction" : "left", "style" : "bar-resize:screenSizeX/2" });
bindings["up" + hyper] = S.op("push", { "direction" : "top", "style" : "bar-resize:screenSizeY/2" });
bindings["down" + hyper] = S.op("push", { "direction" : "bottom", "style" : "bar-resize:screenSizeY/2" });
//corners
bindings["u" + hyper] = S.op("corner", { "direction" : "top-left" , "width" : "screenSizeX/2", "height" : "screenSizeY/2"});
bindings["o" + hyper] = S.op("corner", { "direction" : "top-right" , "width" : "screenSizeX/2", "height" : "screenSizeY/2"});
bindings["n" + hyper] = S.op("corner", { "direction" : "bottom-left" , "width" : "screenSizeX/2", "height" : "screenSizeY/2"});
bindings["." + hyper] = S.op("corner", { "direction" : "bottom-right" , "width" : "screenSizeX/2", "height" : "screenSizeY/2"});
// Window Hints
bindings["esc" + hyper] = S.op("hint");
// Grid
bindings["esc:ctrl"] = S.op("grid");
//resize
function addResizeBinding(num,width) {
bindings[num.toString() + hyper] = function(win) {
var a = win.resize({
"width" : width,
"height" : "screenSizeY"
});
}
}
for (var i = 3; i<7; i++) {
var newWidth = (S.screen().visibleRect().width/i).toFixed();
addResizeBinding(i,newWidth);
}
S.bnda(bindings);