Skip to content

Instantly share code, notes, and snippets.

@vinitkumar
Forked from leb2/.slate.js
Created November 30, 2015 09:07
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 vinitkumar/03a700fd79bfcd784071 to your computer and use it in GitHub Desktop.
Save vinitkumar/03a700fd79bfcd784071 to your computer and use it in GitHub Desktop.
My Slate Config
var MARGIN = 28;
// Fullscreen
slate.bind('f:cmd,alt', function(win) {
// ±4 to account for hidden Dock on left of screen.
win.doOperation(S.op('move', {
'x': 'screenOriginX - 4 + ' + MARGIN,
'y': 'screenOriginY + ' + MARGIN,
'width': 'screenSizeX + 4 - ' + (MARGIN * 2),
'height': 'screenSizeY - ' + (MARGIN * 2)
}));
});
// Fullscreen without gap
slate.bind('f:cmd,ctrl', function(win) {
win.doOperation(S.op('move', {
'x': 'screenOriginX - 4',
'y': 'screenOriginY',
'width': 'screenSizeX + 4',
'height': 'screenSizeY'
}));
});
// Push Right
slate.bind('right:cmd,alt', function(win) {
win.doOperation(S.op('move', {
'x': '(screenSizeX + 4) / 2 + ' + (MARGIN / 2),
'y': 'screenOriginY + ' + MARGIN,
'width': '(screenSizeX + 4) / 2 - ' + (MARGIN * 3 / 2),
'height': 'screenSizeY - ' + (MARGIN * 2)
}));
});
// Push Left
slate.bind('left:cmd,alt', function(win) {
win.doOperation(S.op('move', {
'x': 'screenOriginX - 4 + ' + MARGIN,
'y': 'screenOriginY + ' + MARGIN,
'width': '(screenSizeX + 4) / 2 - ' + (MARGIN * 3 / 2),
'height': 'screenSizeY - ' + (MARGIN * 2)
}));
});
// Push Down
slate.bind('down:cmd,alt', function(win) {
win.doOperation(S.op('move', {
'x': 'windowTopLeftX',
'y': 'screenSizeY / 2 + ' + MARGIN / 2,
'height': 'screenSizeY / 2 -' + 3 * MARGIN / 2,
'width': 'windowSizeX'
}));
});
// Push Up
slate.bind('up:cmd,alt', function(win) {
win.doOperation(S.op('move', {
'x': 'windowTopLeftX',
'y': MARGIN,
'height': 'screenSizeY / 2 -' + 3 * MARGIN / 2,
'width': 'windowSizeX'
}));
});
// Resize
slate.bind('h:cmd,shift', function(win) {
win.doOperation(S.op('resize', {
'width': '-30',
'height': '+0'
}));
});
slate.bind('l:cmd,shift', function(win) {
win.doOperation(S.op('resize', {
'width': '+30',
'height': '+0'
}));
});
// Find
slate.bind('f:cmd,shift', function(win) {
win.doOperation(S.op('hint', {
'characters': 'qwertasdfg'
}));
});
// Switch Right
slate.bind('k:cmd', function(win) {
win.doOperation(S.op('focus', {
'direction': 'right'
}));
});
// Switch Left
slate.bind('j:cmd', function(win) {
win.doOperation(S.op('focus', {
'direction': 'left'
}));
});
// Apps
slate.bind('1:cmd', S.op('focus', {
'app': 'Firefox'
}));
slate.bind('2:cmd', S.op('focus', {
'app': 'iTerm2'
}));
slate.bind('3:cmd', S.op('focus', {
'app': 'Atom'
}));
// Reload Slate
slate.bind('4:cmd', function(win) {
win.doOperation(S.op('relaunch'));
});
slate.bind("1:ctrl", S.op("grid", {
"grids" : {
"1680x1050": {
"width": 16,
"height": 9
},
"1050x1680": {
"width": 9,
"height": 16
}
},
"padding": 5
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment