Created
March 9, 2015 14:32
-
-
Save geecu/d171f4691e53c00f0b3f to your computer and use it in GitHub Desktop.
This file contains 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
var ST_APP_NAME = 'SourceTree'; | |
var resize = function(windowObject, opt) { | |
opt = opt || {}; | |
opt.style = "bar-resize:screenSizeX * .6"; | |
var ST_BOOKMARKS_WIDTH = 500; | |
switch (windowObject.app().name()) { | |
case ST_APP_NAME: | |
opt.style = "bar-resize:screenSizeX - " + ST_BOOKMARKS_WIDTH; | |
switch (windowObject.title()) { | |
case ST_APP_NAME: | |
//ST bookmarks window | |
opt.style = 'bar-resize: ' + ST_BOOKMARKS_WIDTH; | |
opt.direction = opt.direction || 'right'; | |
break; | |
} | |
opt.direction = opt.direction || 'left'; | |
break; | |
} | |
var opRet = windowObject.doOperation(slate.operation("push", opt)); | |
if (0) { | |
S.log('[' + windowObject.title() + ']' + | |
'[' + windowObject.app().name() + ']' + | |
JSON.stringify(opt) + | |
' - returned ' + opRet); | |
} | |
}; | |
slate.bindAll({ | |
"f:cmd,alt": slate.op("move", {"x": "screenOriginX", "y": "screenOriginY", | |
"width": "screenSizeX", "height": "screenSizeY"}), | |
"left:cmd,alt": function(windowObject) { | |
resize(windowObject, {direction: 'left'}); | |
}, | |
"right:cmd,alt": function(windowObject) { | |
resize(windowObject, {direction: 'right'}); | |
}, | |
"right:cmd,ctrl,alt": slate.op("throw", {"screen": "right", "style": | |
"bar-resize:screenSizeX * .6"}), | |
"left:cmd,ctrl,alt": slate.op("throw", {"screen": "left", "style": | |
"bar-resize:screenSizeX * .6"}) | |
}); | |
var startupRetile = function(windowObject) { | |
switch (windowObject.app().name()) { | |
case ST_APP_NAME: | |
resize(windowObject); | |
break; | |
} | |
} | |
slate.on("windowOpened", function(ev, windowObject){ | |
startupRetile(windowObject); | |
}); | |
slate.on("appOpened", function(ev, app){ | |
app.eachWindow(function(windowObject){ | |
startupRetile(windowObject); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment