-
Notifications
You must be signed in to change notification settings - Fork 0
Layouts
Layouts are used to describe a set of operations that run together that you can reference in the layout operation and the slate.default function. This page describes them in detail.
Layouts are created using the slate.layout function
var name = slate.layout(name, description);Layouts are used in the slate.default function
slate.default(screenConfig, layoutName);This will cause the layout with the name layoutName to be activated when Slate sees the screen configuration described by screenConfig.
Layouts can also be used in the slate.operation function along with the layout operation
var layoutOperation = slate.operation("layout", layoutName);This will create an operation that activates the layout with the name layoutName.
When creating layouts using the slate.layout function, two parameters are needed: the name of the layout and a hash containing the description of the layout.
The layout name should be a String and cannot be undefined. e.g. "myLayout"
The layout description should be a hash (cannot be undefined) in the following form:
{
app : params,
app : params,
...
}The name of the Application. This must be a String. e.g. "iTerm"
You may also specify one of the following special application names:
-
"_before_"- this specifies what to do before the layout is activated -
"_after_"- this specifies what to do after the layout is activated
A hash that contains a description of what to do with the Application.
{
"operations" : arrayOfOperationsOrFunctions,
"ignore-fail" : ignoreFail,
"repeat" : repeat,
"repeat-last" : repeatLast,
"main-first" : mainFirst,
"main-last" : mainLast,
"sort-title" : sortTitle,
"title-order" : titleOrder,
"title-order-regex" : titleOrderRegex
}-
arrayOfOperationsOrFunctions- an Array containing any number of operation objects and/or functions. These operations or functions will be applied sequentially to windows within the Application starting with the window that was (or is) focused most recently. If an operation fails, the window will be skipped and the operation will be performed on the next window Slate sees within the Application. If there are more windows than there are elements in this array, the windows beyond the number of elements in this array will not have any operations performed on them. -
ignoreFail- (optional) iftrue, Slate will move on to the next operation or function inarrayOfOperationsOrFunctionseven if the operation failed. -
repeat- (optional) iftrue, Slate will repeat the operations inarrayOfOperationsOrFunctionsuntil all windows have had an operation performed on them. Does not work withrepeatLast. -
repeatLast- (optional) iftrue, Slate will repeat the last operation inarrayOfOperationsOrFunctionsuntil all windows have had an operation performed on them. Does not work withrepeat -
main-first- (optional) iftrue, Slate will reorder the windows such that the main window will have an operation applied on it first. Does not work withmain-last. -
main-last- (optional) iftrue, Slate will reorder the windows such that the main window will have an operation applied on it last. Does not work withmain-first. -
sort-title- (optional) iftrue, Slate will reorder the windows such that they are sorter by title alphabetically increasing. -
title-order- (optional) must beundefinedor a String of semicolon separated window titles. If this is specified, Slate will start applying operations on windows based on the order specified in the String. Windows with titles not in the String will be after those with titles in the String. Does not work withtitle-order-regex. -
title-order-regex- (optional) similar totitle-orderexcept you may specify a Regular Expression to match the titles against instead of the entire title. Note that once a match is seen, the next Regular Expression will be used to match. This means if you have two windows that match the same Regular Expression, only the first one will be matched. The second will not. Does not work withtitle-order