Lokyr
Documentation

Layouts

On this page

macOS · Since 1.5 · ~/.config/lokyr/layouts/

A layout is a session saved to a file: its windows, their tabs and splits, the folder of each pane, and, if you add them, the commands that the panes run. Open a layout and Lokyr opens a new session that looks the same, with new shells. · Since 1.5

Try it

Open a window in a project's folder and split it with ⌘D. Choose Window › Sessions › Save Session as Layout…, name it api, and choose Save. Press ⌃⌘S: the switcher lists api among your layouts. Choose it: a new session opens, its window split the same way, each shell in its folder.

Save a session

Choose Window › Sessions › Save Session as Layout… and give the layout a name. Lokyr writes ~/.config/lokyr/layouts/<name>.toml with the windows of the session that shows: each window's place, each tab's title and color, its splits, and the folder of each pane's shell. When a layout of that name exists already, Lokyr asks before it replaces it, because you may have added commands to it.

Open a layout

Press ⌃⌘S, or choose Window › Sessions › Switch Session…, and choose a layout: the switcher lists them after your sessions, each marked Layout. Lokyr opens a new session named after the layout, with its windows where the file puts them. Each pane's shell starts in its folder, and then runs the pane's command, as though you typed it, so the shell stays when the command ends.

To open a layout from a key of your own, bind window.open-layout with the layout's name:

[keys]
"ctrl+cmd+a" = { command = "window.open-layout", args = { name = "api" } }

Write a layout by hand

A layout is a TOML file. This one opens two windows: the first of a tab split in two, a server on the left and a shell on the right, then a tab for the logs; the second of one tab, in your notes' folder.

# The session's folder, which the switcher finds it by.
folder = "~/src/api"

[[window]]
# Where the window opens, in points from the top left of the main screen.
frame = { x = 80, y = 60, width = 1200, height = 800 }

[[window.tab]]
title = "server"
color = "#3478f6"
[window.tab.split]
direction = "right"    # the second part on the right; "down" puts it below
ratio = 0.6            # the first part's share of the room
[window.tab.split.first.pane]
folder = "~/src/api"
command = "cargo run"
[window.tab.split.second.pane]
folder = "~/src/api"
focused = true         # this pane has the tab's keyboard

[[window.tab]]
title = "logs"
active = true          # the window shows this tab
[window.tab.pane]
folder = "~/src/api"
command = "tail -f log/development.log"

[[window]]

[[window.tab]]
pinned = true
[window.tab.pane]
folder = "~/notes"
KeyWhereWhat it is
folderThe fileThe session's folder, a path from / or ~. The switcher lists no folder of a session, and finds this one there.
[[window]]The fileA window, one at least.
frameA windowWhere the window opens: x and y from the main screen's top left, width and height, in points. Without it, the window opens where a new one would.
[[window.tab]]A windowA tab, one at least.
title, colorA tabA title of its own, and a color, #rrggbb.
activeA tabWhether the window shows this tab rather than its first one.
pinnedA tabWhether the tab is pinned at the window's start.
paneA tab, or a split's partOne pane. A tab, and each part of a split, has a pane or a split.
splitA tab, or a split's partTwo parts: direction, "right" or "down", the ratio of the first part, more than 0 and less than 1, and the parts, first and second.
folderA paneThe folder that its shell starts in, a path from / or ~; your home folder without it.
commandA paneA command line that its shell runs as it starts, as though you typed it.
focusedA paneWhether the pane has its tab's keyboard, rather than the tab's first pane.
zoomedA paneWhether the pane takes its tab's whole room.

Limits

See also