Chapter 9 of 13
The Shortcuts app and automation
Lattika offers actions to the Shortcuts app. Use them in your own shortcuts, run them from Spotlight, or trigger them with the Shortcuts menu bar item. Lattika must be running for any of them to work.
Actions
Snap Front Window to Zone
Moves the frontmost window into a zone of its display's layout. Parameter: the zone number, 1 to 20. Fails if the layout has no such zone. Example: a shortcut named Browser left with one action, Snap the front window to zone 1, run from Spotlight when a browser window is in front.
Apply Layout
Switches a display to a layout. Parameters: the layout, chosen from your list, and optionally a display. Without a display, every display switches. The zones flash. Example: Focus mode applies the Reading Column layout to every display; Meeting applies Halves to the external display only.
Restore Workspace
Puts every window of a saved workspace back. Parameter: the workspace. Returns the number of windows moved, which a later action can use. Example: a shortcut that runs Restore Workspace: Morning and then shows a notification with the returned number.
Save Workspace
Records the current windows under a name. If a workspace with that name exists, it is updated. Parameter: the name. Example: Save desk with the name Docked, run before you unplug your monitors.
Restore Windows to Zones
Puts every remembered window back into its zone (chapter 6). No parameters. Example: an automation that runs it when a Focus mode turns off.
Apply Placement Rules
Runs the per-app rules over every open window (chapter 7). No parameters. Example: run it at login, a few seconds after your apps have opened.
Show Zones
Flashes the zones of every display. No parameters. Example: a shortcut bound to a key in the Shortcuts app for people who prefer that over ⌃⌥Z.
The last three are also offered to Spotlight and Siri with the phrases "Show Lattika zones", "Restore Lattika windows" and "Apply Lattika rules".
URL commands
For scripts and the Open URLs action in Shortcuts, Lattika answers these URLs. In Terminal, run open "lattika://show-zones".
| URL | What it does |
|---|---|
lattika://snap?zone=2 | Snap the focused window into zone 2 (numbers start at 1) |
lattika://snap?zone=2&bundle=com.apple.TextEdit | Snap that app's front window instead |
lattika://show-zones | Flash the zones |
lattika://restore | Restore remembered windows to their zones |
lattika://apply-rules | Apply the rules to every open window |
lattika://workspace?name=Docked | Restore the workspace with that name |
lattika://editor | Open the layout editor; add ?new=1 to open the New Layout sheet |
lattika://settings | Open Settings; add ?pane=zones, shortcuts, rules, workspaces, excludedApps, sync or license for a pane |
lattika://onboarding | Open the welcome window |
Spaces in a workspace name must be written as %20.
If it does not work
- The actions do not appear in Shortcuts. Open Lattika once; macOS registers an app's actions when it runs. If they are still missing, restart the Shortcuts app.
- An action says "Lattika is not running". Start Lattika. Actions cannot start it for you.
- "Layout not found" or "Workspace not found". The layout or workspace was deleted or renamed after the shortcut was built. Pick it again in the action.
- Snap Front Window does nothing. The front window belongs to an excluded app, is not a standard window, or the zone number is higher than the layout has. Also check the Accessibility permission and the trial.
- A URL does nothing. Check the spelling of the host part, for example
show-zoneswith a hyphen. Zone numbers start at 1, not 0.