slate.config('defaultToCurrentScreen', true) slate.bind('up:cmd;ctrl;alt', screenify(topCenter)) slate.bind('down:cmd;ctrl;alt', screenify(bottomCenter)) slate.bind('left:ctrl;alt;shift', screenify(topLeft)) slate.bind('up:ctrl;alt;shift', screenify(topRight)) slate.bind('right:ctrl;alt;shift', screenify(bottomRight)) slate.bind('down:ctrl;alt;shift', screenify(bottomLeft)) slate.bind('left:cmd;ctrl;alt', screenify(left)) slate.bind('right:cmd;ctrl;alt', screenify(right)) slate.bind('m:cmd;ctrl;alt', screenify(mid)) slate.bind('f:cmd;ctrl;alt', screenify(full)) slate.bind('c:cmd;ctrl;alt', screenify(center)) slate.bind('h:cmd;ctrl;alt', screenify(tall)) function topCenter (base, screen) { return slate.operation('move', { screen: screen, x: frac('x', 1/base), y: origin('y'), width: frac('x', 1/base), height: frac('y', 2/3) }) } function bottomCenter (base, screen) { return slate.operation('move', { screen: screen, x: frac('x', 1/base), y: frac('y', 2/3, origin('y')), width: frac('x', 1/base), height: frac('y', 1/3) }) } function topLeft (base, screen) { return slate.operation('corner', { screen: screen, direction: 'top-left', width: frac('x', 1/base), height: frac('y', 2/3) }) } function topRight (base, screen) { return slate.operation('corner', { screen: screen, direction: 'top-right', width: frac('x', 1/base), height: frac('y', 2/3) }) } function bottomLeft (base, screen) { return slate.operation('corner', { screen: screen, direction: 'bottom-left', width: frac('x', 1/base), height: frac('y', 1/3) }) } function bottomRight (base, screen) { return slate.operation('corner', { screen: screen, direction: 'bottom-right', width: frac('x', 1/base), height: frac('y', 1/3) }) } function left (base, screen) { return slate.operation('corner', { screen: screen, direction: 'top-left', width: frac('x', 1/base), height: 'screenSizeY' }) } function right (base, screen) { return slate.operation('corner', { screen: screen, direction: 'top-right', width: frac('x', 1/base), height: 'screenSizeY' }) } function mid (base, screen) { var width = frac('x', 1/base) return slate.operation('move', { screen: screen, x: ['(screenSizeX/2)-(0.5*', width, ')'].join(''), y: origin('y'), width: width, height: 'screenSizeY' }) } function center (base, screen) { var width = frac('x', 1/base) return slate.operation('move', { screen: screen, x: ['(screenSizeX/2)-(0.5*', width, ')'].join(''), y: frac('y', 1/6, origin('y')), width: frac('x', 1/base), height: frac('y', 2/3) }) } function full (base, screen) { return slate.operation('corner', { screen: screen, direction: 'top-left', width: 'screenSizeX', height: 'screenSizeY' }) } function tall (base, screen) { return slate.operation('move', { screen: screen, x: 'windowTopLeftX', y: origin('y'), width: 'windowSizeX', height: frac('y', 1) }) } function frac (axis, mult, offset) { return [ mult || 1, '*', 'screenSize', axis.toUpperCase(), '+', offset || 0 ].join('') } function origin (axis) { return 'screenOrigin' + axis.toUpperCase() } function screenify (fn) { return function (win) { var screen = slate.screen() var base = 2 if (screen.rect().width > 2560) base = 3 win.doOperation(fn(base, screen)) } } // config defaultToCurrentScreen true // config nudgePercentOf screenSize // config resizePercentOf screenSize // alias topLeft corner top-left resize:screenSizeX/3;2*screenSizeY/3 // alias topRight corner top-right resize:screenSizeX/3;2*screenSizeY/3 // alias topCenter move screenSizeX/3;screenOriginY screenSizeX/3;2*screenSizeY/3 // alias bottomLeft corner bottom-left resize:screenSizeX/3;screenSizeY/3 // alias bottomRight corner bottom-right resize:screenSizeX/3;screenSizeY/3 // alias bottomCenter move screenSizeX/3;screenOriginY+2*screenSizeY/3 screenSizeX/3;screenSizeY/3 // // bind left:ctrl;alt;shift ${topLeft} // bind up:ctrl;alt;shift ${topRight} // bind right:ctrl;alt;shift ${bottomRight} // bind down:ctrl;alt;shift ${bottomLeft} // // bind up:cmd;ctrl;alt ${topCenter} // bind down:cmd;ctrl;alt ${bottomCenter} // // bind left:ctrl;alt throw 0 // bind right:ctrl;alt throw 1 // // // bind esc:cmd hint