Last active
January 2, 2016 05:19
-
-
Save nicoster/8256174 to your computer and use it in GitHub Desktop.
my slate config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| my slate config file | |
| nicoster@gmail | |
| */ | |
| function hyper(key){return key + ':ctrl;shift;alt;cmd';} | |
| slate.bind(hyper('r'), slate.op('relaunch')); | |
| // fast switch to common applications | |
| slate.bind(hyper('b'), slate.op('focus', {'app': 'Google Chrome'})); | |
| slate.bind(hyper('s'), slate.op('focus', {'app': 'Sublime Text'})); | |
| slate.bind(hyper('x'), slate.op('focus', {'app': 'Xcode'})); | |
| slate.bind(hyper('m'), slate.op('focus', {'app': 'Mail'})); | |
| slate.bind(hyper('p'), slate.op('focus', {'app': 'Preview'})); | |
| slate.bind(hyper('t'), slate.op('focus', {'app': 'Terminal'})); | |
| slate.bind(hyper('f'), slate.op('focus', {'app': 'Finder'})); | |
| // zoom in/out current window | |
| slate.bind(hyper('i'), slate.op('move', { | |
| 'x': 'max({screenOriginX,windowTopLeftX-windowSizeX*0.05})', | |
| 'y': 'max({screenOriginY,windowTopLeftY-windowSizeY*0.05})', | |
| 'width': 'min({screenSizeX,windowSizeX*1.1})', | |
| 'height': 'min({screenSizeY,windowSizeY*1.1})' | |
| })); | |
| slate.bind(hyper('o'), slate.op('move', { | |
| 'x': 'windowTopLeftX+windowSizeX*0.05', | |
| 'y': 'windowTopLeftY+windowSizeY*0.05', | |
| 'width': 'min({screenSizeX,windowSizeX*0.9})', | |
| 'height': 'min({screenSizeY,windowSizeY*0.9})' | |
| })); | |
| // move around current window | |
| slate.bind(hyper('l'), slate.op('nudge', {'x': '+10%', 'y': '+0'})); | |
| slate.bind(hyper('h'), slate.op('nudge', {'x': '-10%', 'y': '+0'})); | |
| slate.bind(hyper('k'), slate.op('nudge', {'y': '+10%', 'x': '+0'})); | |
| slate.bind(hyper('j'), slate.op('nudge', {'y': '-10%', 'x': '+0'})); | |
| // center | |
| slate.bind(hyper('e'), slate.op('move', { | |
| 'x': 'screenOriginX+max({0,screenSizeX-windowSizeX})/2', | |
| 'y': 'screenOriginY+max({0,screenSizeY-windowSizeY})/2', | |
| 'width': 'min({screenSizeX,windowSizeX})', | |
| 'height': 'min({screenSizeY,windowSizeY})' | |
| })); | |
| // push current window to left/right | |
| slate.bind(hyper('['), slate.op('push',{'direction': 'left', 'style': 'bar-resize:screenSizeX/2'})); | |
| slate.bind(hyper(']'), slate.op('push',{'direction': 'right', 'style': 'bar-resize:screenSizeX/2'})); | |
| // throw current window to next screen | |
| function next_screen(wnd){ | |
| var next = slate.screen().isMain() ? '1' : '0'; | |
| wnd.doOperation(slate.op('throw', { | |
| 'screen': next, | |
| 'x': 'screenOriginX+max({0,screenSizeX-windowSizeX})/2', | |
| 'y': 'screenOriginY+max({0,screenSizeY-windowSizeY})/2', | |
| 'width': 'min({screenSizeX,windowSizeX})', | |
| 'height': 'min({screenSizeY,windowSizeY})' | |
| })); | |
| } | |
| slate.bind(hyper('`'), next_screen); | |
| slate.bind('f13', next_screen); | |
| // maximize and restore | |
| slate.bind(hyper('z'), function(wnd){ | |
| // wnd.doOperation(slate.op('snapshot', { | |
| // 'name': wnd.title() + '-max', | |
| // 'save': false, | |
| // 'stack': true | |
| // })); | |
| wnd.doOperation( slate.operation("move", { | |
| "x" : "screenOriginX", | |
| "y" : "screenOriginY", | |
| "width" : "screenSizeX", | |
| "height" : "screenSizeY" | |
| })); | |
| }); | |
| // slate.bind('down:cmd', function(wnd){ | |
| // wnd.doOperation(slate.op('activate-snapshot', {'name': wnd.title() + '-max','delete': true})); | |
| // }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment