Phin Tech docs Lazy Susan in the store →

Integrating another app with Lazy Susan

Another app (Cubicle, say) can add a group of its own commands to Lazy Susan, and can fill groups at run time with live data such as its workspaces. Nothing here needs Lazy Susan's code: an app writes JSON and opens a URL.

(OmniWM has no way to do this itself, so Lazy Susan ships a tool for it: see "OmniWM keys" in the README.)

Is Lazy Susan installed? #

Its bundle identifier is tech.phin.LazySusan:

let installed = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "tech.phin.LazySusan") != nil

Items #

Everything uses the same item format as Lazy Susan's own config.json:

{ "key": "g", "type": "command", "label": "Go to workspace", "value": "/path/to/cubicle go {input}" }
{ "key": "d", "type": "url", "label": "Docs", "value": "https://example.com" }
{ "key": "w", "type": "group", "label": "Windows", "actions": [ /* items */ ] }
{ "key": "s", "type": "group", "label": "Switch to", "source": "/path/to/cubicle leader go" }

Dynamic groups #

A group with a source command (and no actions) is filled each time the user enters it. Lazy Susan runs the command and reads its standard output as JSON: either an array of items or { "actions": [ ... ] }.

Example output of cubicle leader go:

[
  { "key": "1", "type": "command", "label": "Mail", "value": "\"/Applications/Cubicle.app/Contents/Helpers/cubicle\" go 1" },
  { "key": "2", "type": "command", "label": "Code", "value": "\"/Applications/Cubicle.app/Contents/Helpers/cubicle\" go 2" }
]

Installing a group #

  1. Write one group item, with a key, to a JSON file. Leave it in place: Lazy Susan reads it when it handles the URL, which can be a moment later if Lazy Susan has to launch first.
  2. Open lazysusan://install?file=<the file's absolute path, percent-encoded>.

Lazy Susan asks the user before changing anything, then adds the group to the top level of their config. If the key is taken, the user can replace what's there or cancel. Installing again later replaces the old copy, so an app can offer "Update" with the same call.