Lint slate config and add additional bindings

This commit is contained in:
William Carroll 2018-01-08 15:14:01 -05:00
parent 54e10baa6c
commit dd431f5f28

View file

@ -4,7 +4,9 @@
// Hotkeys for quickly opening apps & changing window size // Hotkeys for quickly opening apps & changing window size
var modal_key = ":alt;shift"; var modal_key = ":alt;shift;cmd;ctrl"; // hyper key
var resize_key = ":alt;shift;ctrl"; // meh key
// Configs // Configs
S.cfga({ S.cfga({
@ -14,25 +16,66 @@ S.cfga({
focusCheckWidthMax: 3000, focusCheckWidthMax: 3000,
}); });
// Window size /position shortcuts
// ctrl+shift+h = use left half of screen.
// ctrl+shift+l = right half, hjkl
// ctrl+shift+m = use full window
S.bnda({
// Push Bindings
"l:ctrl;shift" : S.op("move", { "x": "screenSizeX/2 + screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX*0.5 - 40", "height": "screenSizeY-100" }),
";:ctrl;shift" : S.op("move", { "x": "screenSizeX/3*2 + screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX/3 - 40", "height": "screenSizeY-100" }),
"h:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX*0.5 - 40", "height": "screenSizeY-100" }), // window resizing bindings
"g:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX/3*2 - 40", "height": "screenSizeY-100" }), var window_resizing_bindings = {
';': {
x: 'screenSizeX/3*2 + screenOriginX+20',
y: 'screenOriginY+20',
width: 'screenSizeX/3 - 40',
height: 'screenSizeY-100'
},
'g': {
x: 'screenOriginX+20',
y: 'screenOriginY+20',
width: 'screenSizeX/3*2 - 40',
height: 'screenSizeY-100'
},
'o': {
x: 'screenSizeX / 2 + screenOriginX + 20',
y: 'screenOriginY + 20',
width: 'screenSizeX / 2 - 40',
height: '(screenSizeY - 120) / 2'
},
',': {
x: 'screenSizeX / 2 + screenOriginX + 20',
y: '(screenSizeY - 120) / 2 + 20 + 20',
width: 'screenSizeX / 2 - 40',
height: '(screenSizeY - 120) / 2'
},
'h': {
x: 'screenOriginX+20',
y: 'screenOriginY+20',
width: 'screenSizeX*0.5 - 40',
height: 'screenSizeY-100'
},
'j': {
x: 'screenOriginX+screenSizeX/6',
y: 'screenOriginY+20',
width: '2*screenSizeX/3',
height: 'screenSizeY - 100'
},
'k': {
x: 'screenOriginX+20',
y: 'screenOriginY+20',
width: 'screenSizeX - 40',
height: 'screenSizeY - 100'
},
'l': {
x: 'screenSizeX/2 + screenOriginX+20',
y: 'screenOriginY+20',
width: 'screenSizeX*0.5 - 40',
height: 'screenSizeY-100'
},
}
"k:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY/2 - 20" }), var window_resizing_bindings = Object.keys(window_resizing_bindings).reduce(function(acc, kbd) {
"j:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenSizeY/2 + screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY/2 - 40" }), acc[kbd + resize_key] = S.op('move', window_resizing_bindings[kbd]);
"m:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY - 100" }), return acc;
"n:ctrl;shift" : S.op("move", { "x": "screenOriginX+screenSizeX/6", "y": "screenOriginY+20", "width": "2*screenSizeX/3", "height": "screenSizeY - 100" }), }, {});
"b:ctrl;shift" : S.op("move", { "x": "screenOriginX+screenSizeX/4", "y": "screenOriginY+20", "width": "screenSizeX/2", "height": "screenSizeY - 100" }),
}); S.bnda(window_resizing_bindings);
// Moves applications across multiple screens // Moves applications across multiple screens
@ -43,11 +86,9 @@ slate.bind('1:ctrl', throwLeft);
slate.bind('2:ctrl', throwRight); slate.bind('2:ctrl', throwRight);
// Binds modal key + {char} to focus different open apps
// alt + d = focus Dash
var focus_apps = { var focus_apps = {
1: '1Password', 1: '1Password',
i: 'iTunes',
a: 'Atom', a: 'Atom',
h: 'Dash', h: 'Dash',
e: 'Emacs', e: 'Emacs',
@ -58,6 +99,8 @@ var focus_apps = {
l: 'LimeChat', l: 'LimeChat',
k: 'Slack', k: 'Slack',
w: 'Wireshark', w: 'Wireshark',
p: 'Tomato One',
d: 'Discord',
}; };