Skip to content

Instantly share code, notes, and snippets.

@coudron
Last active July 11, 2016 17:50
Show Gist options
  • Save coudron/02208219d9ce94eec91a to your computer and use it in GitHub Desktop.
Save coudron/02208219d9ce94eec91a to your computer and use it in GitHub Desktop.
Slate config file
var current_position = 0;
var pushLeft = slate.operation("move", {
"x": "screenOriginX",
"y": "screenOriginY",
"width": "screenSizeX/2",
"height": "screenSizeY"
});
var pushRight = slate.operation("move", {
"x": "screenOriginX+screenSizeX/2",
"y": "screenOriginY",
"width": "screenSizeX/2",
"height": "screenSizeY"
});
var fullscreen = slate.operation("move", {
"x": "screenOriginX",
"y": "screenOriginY",
"width": "screenSizeX",
"height": "screenSizeY"
});
slate.bind("right:ctrl,cmd", function(win) {
win.doOperation(pushRight);
});
slate.bind("left:ctrl,cmd", function(win) {
win.doOperation(pushLeft);
});
slate.bind("up:ctrl,cmd", function(win) {
win.doOperation(fullscreen);
});
slate.bind("down:ctrl,cmd", function(win) {
var x = "screenOriginX";
var y = "screenOriginY";
if (current_position == 1 || current_position == 3){
x = "screenOriginX+screenSizeX/2";
}
if (current_position == 2 || current_position == 3){
y = "screenOriginY+screenSizeY/2";
}
win.doOperation(slate.operation("move", {
"x": x,
"y": y,
"width": "screenSizeX/2",
"height": "screenSizeY/2"
}));
current_position += 1;
current_position = current_position % 4;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment