dotfiles/dotfiles/slate.js

85 lines
1.9 KiB
JavaScript
Raw Normal View History

slate.configAll({
windowHintsIgnoreHiddenWindows: false,
windowHintsShowIcons: true,
windowHintsSpread: true,
switchShowTitles: true,
windowHintsSpreadSearchHeight: 100,
windowHintsSpreadSearchWidth: 100,
windowHintsSpreadPadding: 40
});
2014-10-23 04:42:35 -06:00
var hint = slate.op("hint", {
"characters" : "ASDFGHJKLQWERTYUIOPCVBN"
});
2014-10-24 07:19:23 -06:00
2014-10-23 04:42:35 -06:00
var grid = slate.op("grid", {
grids: {
2014-10-24 08:16:07 -06:00
"1920x1080": {"width": 8, "height": 6},
"1440x900": {"width": 8, "height": 6}
2014-10-23 04:42:35 -06:00
}
});
2014-10-24 08:16:07 -06:00
function quarterCorner(corner) {
return slate.op("corner", {
direction: corner,
width: "screenSizeX/2",
height: "screenSizeY/2"
});
}
2014-10-24 07:19:23 -06:00
var hyper = ":ctrl;shift;alt;cmd";
2014-10-24 08:16:07 -06:00
function hyperBindAll(mapping) {
console.log(_.object(_.map(
_.pairs(mapping),
function(key, op) { return [key + hyper, op]; }
)));
return slate.bindAll(
_.object(_.map(
_.pairs(mapping),
function(pair) { return [pair[0] + hyper, pair[1]]; }
))
);
}
function focusApp(app) {
return slate.op("focus", {"app" : app});
}
hyperBindAll({
h: hint,
// Simple Layout
f: slate.op("corner", {
direction: "top-left",
width: "screenSizeX",
height: "screenSizeY"
}),
q: slate.op("corner", {
direction: "top-left",
width: "screenSizeX/2",
height: "screenSizeY"
}),
w: slate.op("corner", {
direction: "top-right",
width: "screenSizeX/2",
height: "screenSizeY"
}),
a: quarterCorner("top-left"),
s: quarterCorner("top-right"),
z: quarterCorner("bottom-left"),
2015-03-08 01:36:46 -07:00
n: slate.op("throw", {
"width": "windowSizeX",
"height": "windowSizeY",
"screen": "next"
}),
x: quarterCorner("bottom-right"),
2014-10-24 08:16:07 -06:00
// App focus
e: focusApp("Emacs"),
c: focusApp("Google Chrome"),
t: focusApp("iTerm"),
m: focusApp("Spotify"),
2014-10-24 08:16:07 -06:00
// Slate operations
r: slate.op("relaunch"),
u: slate.op("undo")
2014-10-23 04:42:35 -06:00
});
2014-10-24 08:16:07 -06:00
slate.bindAll({"esc:cmd": hint, "space:alt": grid});