Skip to content
jigish edited this page Jan 25, 2013 · 20 revisions

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.

Usage

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.

Description

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.

name

The layout name should be a String and cannot be undefined. e.g. "myLayout"

description

The layout description should be a hash (cannot be undefined) in the following form:

{
  app : params,
  app : params,
  ...
}
app

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
params

A hash that contains a description of what to do with the Application.

{
  "operations" : arrayOfOperationsOrFunctions,
  "repeat" : repeat,
  "repeat-last" : repeatLast,
  "ignore-fail" : ignoreFail,
  "main-first" : mainFirst,
  "main-last" : mainLast,
  "sort-title" : sortTitle,
  "title-order" : titleOrder,
  "title-order-regex" : titleOrderRegex
}

Examples

Clone this wiki locally