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

68 lines
2.6 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
2017-09-15 17:56:40 +02:00
var modal_key = ":alt;shift";
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
});
// 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" }),
2017-05-26 17:24:04 +02:00
";:ctrl;shift" : S.op("move", { "x": "screenSizeX/3*2 + screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX/3 - 40", "height": "screenSizeY-100" }),
2017-05-22 17:22:30 +02:00
"h:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX*0.5 - 40", "height": "screenSizeY-100" }),
2017-05-26 17:24:04 +02:00
"g:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX/3*2 - 40", "height": "screenSizeY-100" }),
2017-05-22 17:22:30 +02:00
"k:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY/2 - 20" }),
"j:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenSizeY/2 + screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY/2 - 40" }),
"m:ctrl;shift" : S.op("move", { "x": "screenOriginX+20", "y": "screenOriginY+20", "width": "screenSizeX - 40", "height": "screenSizeY - 100" }),
"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" }),
});
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
// Binds modal key + {char} to focus different open apps
2017-05-26 17:24:04 +02:00
// alt + d = focus Dash
2017-05-22 17:22:30 +02:00
var focus_apps = {
2017-08-01 15:43:59 +02:00
1: '1Password',
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',
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}));
});