Skip to content

Instantly share code, notes, and snippets.

@davidmerrique
Created April 10, 2013 04:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidmerrique/5351783 to your computer and use it in GitHub Desktop.
Save davidmerrique/5351783 to your computer and use it in GitHub Desktop.
My Slate config. Allows for margins between windows and screen edges.
var margin = 15;
S.cfga({
"defaultToCurrentScreen" : true,
"secondsBetweenRepeat" : 0.1,
"checkDefaultsOnLoad" : true,
"focusCheckWidthMax" : 3000
});
// Create Operations
var topLeft = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY/2-" + margin * 1.5
});
var topRight = S.operation("move", {
"x" : "screenOriginX+screenSizeX/2+" + margin / 2,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY/2-" + margin * 1.5
});
var bottomRight = S.operation("move", {
"x" : "screenOriginX+screenSizeX/2+" + margin / 2,
"y" : "screenOriginY+screenSizeY/2+" + margin / 2,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY/2-" + margin * 1.5
});
var bottomLeft = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+screenSizeY/2+" + margin / 2,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY/2-" + margin * 1.5
});
var pushRight = S.operation("move", {
"x" : "screenOriginX+screenSizeX/2+" + margin / 2,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY-" + margin * 2
});
var pushLeft = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX/2-" + margin * 1.5,
"height" : "screenSizeY-" + margin * 2
});
var pushTop = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX-" + margin * 2,
"height" : "screenSizeY/2-" + margin * 1.5
});
var pushBottom = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+screenSizeY/2+" + margin / 2,
"width" : "screenSizeX-" + margin * 2,
"height" : "screenSizeY/2-" + margin * 1.5
});
var fullscreen = S.operation("move", {
"x" : "screenOriginX+" + margin,
"y" : "screenOriginY+" + margin,
"width" : "screenSizeX-" + margin * 2,
"height" : "screenSizeY-" + margin * 2
});
var centered = S.operation("move", {
"x": "screenOriginX+150",
"y": "screenOriginY+80",
"width": "screenSizeX-300",
"height": "screenSizeY-180"
});
S.bind("down:shift;alt;cmd", bottomLeft);
S.bind("right:shift;alt;cmd", bottomRight);
S.bind("left:shift;alt;cmd", topLeft);
S.bind("up:shift;alt;cmd", topRight);
S.bind("left:ctrl;alt;cmd", pushLeft);
S.bind("right:ctrl;alt;cmd", pushRight);
S.bind("down:ctrl;alt;cmd", pushBottom);
S.bind("up:ctrl;alt;cmd", pushTop);
S.bind("c:ctrl;alt;cmd", centered);
S.bind("m:ctrl;alt;cmd", fullscreen);
S.bnda({
"right:cmd;alt": S.op("nudge", { "x": "+3%", "y": "+0" }),
"left:cmd;alt": S.op("nudge", { "x": "-3%", "y": "+0" }),
"up:cmd;alt": S.op("nudge", { "x": "+0", "y": "-3%" }),
"down:cmd;alt": S.op("nudge", { "x": "+0", "y": "+3%" }),
"right:ctrl;alt" : S.op("resize", { "width" : "+3%", "height" : "+0" }),
"left:ctrl;alt" : S.op("resize", { "width" : "-3%", "height" : "+0" }),
"up:ctrl;alt" : S.op("resize", { "width" : "+0", "height" : "-3%" }),
"down:ctrl;alt" : S.op("resize", { "width" : "+0", "height" : "+3%" })
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment