Skip to content

Instantly share code, notes, and snippets.

@eunjae-lee
Created February 26, 2015 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eunjae-lee/9922beeafe26a4b57b7d to your computer and use it in GitHub Desktop.
Save eunjae-lee/9922beeafe26a4b57b7d to your computer and use it in GitHub Desktop.
Slate Configuration File
// https://github.com/jigish/slate
// https://github.com/jigish/slate/wiki/JavaScript-Configs
// https://github.com/jigish/dotfiles/blob/master/slate.js
S.cfga({
"defaultToCurrentScreen" : true,
"secondsBetweenRepeat" : 0.1,
"checkDefaultsOnLoad" : true,
"focusCheckWidthMax" : 3440,
"orderScreensLeftToRight" : true
});
var monitorLG = "3440x1400";
var monitorLaptop = "2880x1800";
var oneOps = {
"Google Chrome": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+172",
"y": "screenOriginY",
"width": "1146",
"height": "873"
}),
"Android Studio": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+123",
"y": "screenOriginY",
"width": "1196",
"height": "877"
}),
"IntelliJ IDEA": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+123",
"y": "screenOriginY",
"width": "1196",
"height": "877"
}),
"iTerm": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX",
"y": "screenOriginY",
"width": "856",
"height": "548"
}),
"iTunes": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX",
"y": "screenOriginY+473",
"width": "400",
"height": "400"
}),
"Sublime Text": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+588",
"y": "screenOriginY+36",
"width": "1246",
"height": "693"
}),
"Mailbox (Beta)": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+194",
"y": "screenOriginY",
"width": "1092",
"height": "873"
}),
"KakaoTalk": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+1030",
"y": "screenOriginY",
"width": "410",
"height": "660"
}),
"Airmail": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX+191",
"y": "screenOriginY+119",
"width": "1058",
"height": "633"
})
};
var twoOps = {
"Google Chrome": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+1086",
"y": "screenOriginY",
"width": "1511",
"height": "screenSizeY"
}),
"Android Studio": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+screenSizeX/4",
"y": "screenOriginY",
"width": "screenSizeX/2",
"height": "screenSizeY"
}),
"IntelliJ IDEA": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+screenSizeX/4-200",
"y": "screenOriginY",
"width": "screenSizeX/2",
"height": "screenSizeY"
}),
"iTerm": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+screenSizeX/4-400",
"y": "screenOriginY",
"width": "screenSizeX/3",
"height": "screenSizeY/2"
}),
"iTunes": S.op("move", {
"screen": monitorLaptop,
"x": "screenOriginX",
"y": "screenOriginY+473",
"width": "400",
"height": "400"
}),
"Sublime Text": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+1265",
"y": "screenOriginY+178",
"width": "1440",
"height": "873"
}),
"Mailbox (Beta)": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+1200",
"y": "screenOriginY+310",
"width": "1092",
"height": "877"
}),
"KakaoTalk": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+3030",
"y": "screenOriginY",
"width": "410",
"height": "660"
}),
"Airmail": S.op("move", {
"screen": monitorLG,
"x": "screenOriginX+851",
"y": "screenOriginY+430",
"width": "1440",
"height": "873"
})
}
var makeDefaultLayoutParams = function (opts) {
var result = {};
for (var key in opts) {
result[key] = {
"operations": [opts[key]],
"ignore-fail": true,
"repeat": true
}
}
return result;
};
var twoMonitorLayout = S.lay("twoMonitor", makeDefaultLayoutParams(twoOps));
var oneMonitorLayout = S.lay("oneMonitor", makeDefaultLayoutParams(oneOps));
S.def(2, twoMonitorLayout);
S.def(1, oneMonitorLayout);
var universalLayout = function() {
// Should probably make sure the resolutions match but w/e
S.log("SCREEN COUNT: "+S.screenCount());
if (S.screenCount() === 2) {
S.op("layout", { "name" : twoMonitorLayout }).run();
} else if (S.screenCount() === 1) {
S.op("layout", { "name" : oneMonitorLayout }).run();
}
};
S.bnda({
// Layout Bindings
"pageUp:cmd" : universalLayout,
"end:cmd" : S.op("focus", { "direction" : "left" }),
"pageDown:cmd" : S.op("focus", { "direction" : "right" }),
"1:ctrl": S.op("relaunch")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment