-
Notifications
You must be signed in to change notification settings - Fork 512
Defaults
Jigish Patel edited this page Jan 26, 2013
·
2 revisions
Defaults are used to activate layouts, snapshots or run functions when Slate sees a particular screen configuration. Defaults are set using the slate.default
function. This page describes them in detail.
Defaulting a screen configuration to a layout
slate.default(screenConfig, layoutName);
Defaulting a screen configuration to a snapshot
slate.default(screenConfig, snapshotName);
slate.default(screenConfig, function() {
// do something
});
Screen configurations come in two forms: a String with the number of screens or an Array with the screen resolutions.
"3"
This describes any screen configuration with exactly 3 monitors.
["1680x1050","2560x1440"]
This describes any screen configuration with exactly 2 monitors with the resolutions "1680x1050"
and "2560x1440"
This is described in detail here.
Simply call default with a screen configuration and the snapshot name to activate when Slate sees it.
// Create the snapshot
var snapshotName = "omgSnapshotsAreCool";
slate.operation("snapshot", { "name" : snapshotName });
// Default the snapshot to activate when Slate sees 2 mointors
slate.default("2", snapshotName);
Simply call default with a screen configuration and a function to be run when Slate sees it.
// Default the function to run when Slate sees 2 mointors with the resolutions "1680x1050" and "2560x1440"
slate.default(["1680x1050","2560x1440"], function() {
// Cycle through each app (you don't have to do this, you can do anything you really want)
slate.eachApp(function(appObject) {
// Cycle through each window within the app
appObject.eachWindow(function(windowObject) {
// Push the window to the right. Obviously you can do whatever you want with the window object here.
windowObject.doOperation(slate.operation("push", { "direction" : "right" });
});
});
});