tvl-depot/configs/os_x/.slate.js

111 lines
2.5 KiB
JavaScript
Raw Normal View History

2017-05-22 17:22:30 +02:00
/* globals S,slate,_ */
// Bindings for slate.
// Forked from rschmukler/dotfiles
// Hotkeys for quickly opening apps & changing window size
var modal_key = ":alt;shift;cmd;ctrl"; // hyper key
var resize_key = ":alt;shift;ctrl"; // meh key
2017-05-22 17:22:30 +02:00
// Configs
S.cfga({
2017-09-15 17:57:01 +02:00
defaultToCurrentScreen: true,
secondsBetweenRepeat: 0.1,
checkDefaultsOnLoad: true,
focusCheckWidthMax: 3000,
2017-05-22 17:22:30 +02:00
});
2017-05-26 17:24:04 +02:00
// window resizing bindings
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'
},
}
2017-05-26 17:24:04 +02:00
var window_resizing_bindings = Object.keys(window_resizing_bindings).reduce(function(acc, kbd) {
acc[kbd + resize_key] = S.op('move', window_resizing_bindings[kbd]);
return acc;
}, {});
S.bnda(window_resizing_bindings);
2017-05-22 17:22:30 +02:00
2017-05-26 17:24:04 +02:00
// Moves applications across multiple screens
2017-09-15 17:57:10 +02:00
var throwLeft = slate.operation('throw', {screen: '0', width: 'screenSizeX', height: 'screenSizeY',});
var throwRight = slate.operation('throw', {screen: '1', width: 'screenSizeX', height: 'screenSizeY',});
slate.bind('1:ctrl', throwLeft);
slate.bind('2:ctrl', throwRight);
2017-05-22 17:22:30 +02:00
var focus_apps = {
2017-08-01 15:43:59 +02:00
1: '1Password',
i: 'iTunes',
a: 'Atom',
2017-05-26 17:24:04 +02:00
h: 'Dash',
e: 'Emacs',
t: 'iTerm2',
2017-05-22 17:22:30 +02:00
m: 'Messages',
2017-06-01 16:26:57 +02:00
s: 'Spotify',
2017-05-22 17:22:30 +02:00
c: 'Google Chrome',
l: 'LimeChat',
2017-06-01 16:26:57 +02:00
k: 'Slack',
w: 'Wireshark',
p: 'Tomato One',
d: 'Discord',
2017-05-22 17:22:30 +02:00
};
2017-05-26 17:24:04 +02:00
Object.keys(focus_apps).forEach(function(key) {
app = focus_apps[key];
2017-05-22 17:22:30 +02:00
S.bind(key + modal_key, S.op("focus", {app: app}));
});