Lokyr
Documentation

Sessions

On this page

macOS · Since 1.5 · [sessions] folders, [app] restore-windows

A session is a group of windows, such as one for each project. One session shows at a time: when you switch, its windows come back where you left them, and the others hide. The programs in hidden windows keep running, so a build or a server goes on while you work on something else.

Try it

Choose Window › Sessions › New Session: your windows hide and a new one opens. Press ⌃⌘L: your windows come back. Press ⌃⌘L again to go back to the new session.

Then list your projects. Add this to your config, with the folder that holds your projects:

[sessions]
folders = ["~/src/*"]

Press ⌃⌘S: your projects show after your sessions. Choose one: a session opens there, named after the folder, its shell in the folder.

What it gives you

Start a session

Lokyr starts in a session with no name. A window that you open, with ⌘N or from a folder in the Finder, opens in the session that shows.

Switch sessions

Press ⌃⌘S, or choose Window › Sessions › Switch Session…, and choose an entry. The switcher lists:

As you type, the switcher finds sessions and layouts by their names, and folders by their names and paths. The best match comes first: ui finds the folder ui before Untitled Session. When two match as well, sessions come first, then layouts, then folders.

Press ⌃⌘L, or choose Window › Sessions › Switch to Last Session, to switch to the session you used before. Press it again to come back.

To switch to a session with a key of your own, bind window.switch-session with the session's name:

[keys]
"ctrl+cmd+1" = { command = "window.switch-session", args = { name = "api" } }

List your projects' folders

folders, in the config's [sessions], lists the folders that the switcher shows:

[sessions]
folders = ["~/src/*", "~/notes"]

Name, save and close a session

Settings

[sessions]
folders = ["~/src/*"]          # the folders that the switcher lists

[app]
restore-windows = "always"     # open your sessions and their windows again at every start
restore-scrollback = true      # their panes show what they showed when you quit

Commands and keys

CommandTitleArgumentsDefault keys
command-palette.sessionsSwitch Session…⌃⌘S
window.new-sessionNew Session
window.switch-to-last-sessionSwitch to Last Session⌃⌘L
window.switch-sessionSwitch to Sessionname, text
window.rename-sessionRename Session…
window.save-layoutSave Session as Layout…
window.open-layoutOpen Layoutname, text
window.close-sessionClose Session

The commands' reference lists them with the other commands of the windows.

How it works

Limits

Troubleshooting

The switcher lists no recent folders

Why: the recent folders come from your shells, which report their folder through shell integration.

Fix: turn shell integration on, or set up your shell to report its folder with OSC 7, as the escape codes' reference describes.

Check: open a new tab, cd into a folder, then press ⌃⌘S: the folder shows, marked Recent.

A folder doesn't show in the switcher

Why: a session was opened in that folder, and shows as that session; or the path in folders starts with neither / nor ~, or names no folder. Lokyr lists the folders in the background, and a folder on a slow disk shows a moment after the switcher opens. A last part * of a folder of more than 500 entries lists the folders among the first 500 that the folder gives.

Fix: choose the session, or correct the path, such as "~/src/*" for every folder in ~/src.

My sessions don't come back when Lokyr starts

Why: restore-windows follows macOS's Close windows when quitting an application, which is on by default.

Fix: set restore-windows = "always" in your config's [app], or turn that setting off in System Settings › Desktop & Dock.

See also