Skip to content

Instantly share code, notes, and snippets.

@lingqingmeng
Created May 23, 2017 20:07
Show Gist options
  • Save lingqingmeng/480bc5bd347407e5c3889f50da4aa623 to your computer and use it in GitHub Desktop.
Save lingqingmeng/480bc5bd347407e5c3889f50da4aa623 to your computer and use it in GitHub Desktop.
slate.configAll({
'defaultToCurrentScreen': true,
'checkDefaultsOnLoad': true
});
var layout = {
maximize: S.op('move', {
'y' : 'screenOriginY',
'x' : 'screenOriginX',
'width' : 'screenSizeX',
'height' : 'screenSizeY'
}),
peak: S.op('move', {
'y' : 'screenOriginY',
'x' : 'screenOriginX',
'width' : 'screenSizeX/1.6',
'height' : 'screenSizeY'
}),
pop: S.op('move', {
'y' : 'screenOriginY',
'x' : 'screenSizeX/2',
'width' : 'screenSizeX/2.7',
'height' : 'screenSizeY'
}),
pushRight: S.op('push', {
'direction' : 'right',
'style' : 'bar-resize:screenSizeX/2'
}),
pushLeft: S.op('push', {
'direction' : 'left',
'style' : 'bar-resize:screenSizeX/2'
}),
pushBottom: slate.operation('push', {
'direction' : 'bottom',
'style' : 'bar-resize:screenSizeY/2'
})
};
var operations = {
throw0: S.op('throw', {
'screen': '0',
'width': 'screenSizeX',
'height': 'screenSizeY'
}),
throw1: S.op('throw', {
'screen' : '1',
'width' : 'screenSizeX',
'height' : 'screenSizeY'
})
};
slate.bindAll({
// Directionals
'up:ctrl,alt,cmd': layout.maximize,
'l:ctrl,alt,cmd': layout.peak,
'return:ctrl,cmd,alt': layout.pop,
'down:ctrl,cmd,alt': layout.pushBottom,
'right:ctrl,cmd,alt': layout.pushRight,
'left:ctrl,cmd,alt': layout.pushLeft,
'[:ctrl,cmd,alt': operations.throw0,
']:ctrl,cmd,alt': operations.throw1
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment