Expand description
Several workspaces, one open at a time (docs/specs/SPEC_WORKSPACES_2026_10_23.md
§3.2, §6): list them, make a new one, switch, delete one. Not the srv
Workspace object, which is one window’s contents.
Switching (workspace.SwitchUserWorkspace, and the switch that ends
CreateUserWorkspace and Import…), all in srv:
- the open workspace is saved, then saves wait (
LayoutWrites::hold_saves) until the windows have moved, so no save stores a mix of the two; - its windows other than the one the user acted from close here: their
rows go, their contents stay, and their windows stay
openin its record. The host closes the OS windows afterwards (the reply names them); - the other workspace becomes the open one (
workspace:current,workspace:name, itsopened_at), and the closed windows, the restored windows waiting to open and the session record of the one before are forgotten: its record holds them; - its record is restored as a cold start restores one
(
session_windows::restore_all): contents still here are reused, those that are gone are rebuilt from the record, its closed windows are listed closed. A record with nothing to restore (a new workspace) gets the default panes; - the window the user acted from shows the first window’s contents, with
its name and appearance; the rest wait for that window to open them
(
TakeRestoredWindows); - the contents the closed workspace showed have their shells stopped and
their agents parked (they keep running,
agents:always_available; the saved record names them, and switching back puts them in their tabs), after the reply, one switch at a time. The next switch waits for that.
The next launch opens the workspace that was open last: it is the one the client names.
Structs§
- Saves
Held 🔒 - Holds saves for as long as it lives.
- Switched 🔒
- What a switch did, for the window that asked.
Constants§
- SWITCH_
META_ 🔒KEYS - The client meta keys a switch changes: the open workspace, its closed windows, the restored windows’ queues and the quit’s session record.
Statics§
- SWITCH_
LOCK 🔒 - One switch at a time, held until the closed workspace’s agents have stopped: the next switch may reopen those contents.
Functions§
- apply 🔒
- Apply
eventsto the store and publish them; the first error the reducer returned, if any, instead. - arg_str 🔒
- client 🔒
- client_
meta_ 🔒of - client_
update 🔒 - The client, whose meta names the open workspace, as an object update.
- handle_
agents 🔒 workspace.UserWorkspaceAgents(): the agents running in the open workspace’s windows, each{block_id, name, working}, for the warning before a switch closes it.- handle_
create 🔒 workspace.CreateUserWorkspace(name, windowId): a new workspace, switched to at once; its first window shows the default panes. The same reply asSwitchUserWorkspace. A switch that fails leaves no workspace behind.- handle_
delete 🔒 workspace.DeleteUserWorkspace(workspaceId): delete a workspace that isn’t open: its row, and the contents of its windows still kept here. Its agents stay in My Agents.- handle_
list 🔒 workspace.ListUserWorkspaces: every workspace, the most recently opened first, each{id, name, current, opened_at, windows, closed}(its open and closed windows, as last saved).- handle_
switch 🔒 workspace.SwitchUserWorkspace(workspaceId, windowId): switch to another workspace from windowwindowId. Returns{id, name, closed: [{window_id, label}], beside}: the windows for the host to close, and how many wait to open beside this one (TakeRestoredWindows).- insert_
workspace 🔒 - A new, empty workspace named
name. - kept_
contents 🔒 - The window contents workspace
rowkeeps (its record’s), less any that a window shows, that the open workspace lists as closed, or that wait to open. - open_
target 🔒 - Make
targetthe open workspace and show its first window inacting; returns that window’s contents. - reply 🔒
- restore_
client_ 🔒meta - Put
saved(fromclient_meta_of) back, in one transaction. - set_
current 🔒 - Make
rowthe open workspace: the client names it, and forgets what belonged to the one before (its closed windows, its restored windows waiting to open, the session record), which that one’s record holds. - switch_
to 🔒 - Switch to workspace
target_id, reusing windowwindow_idfor its first window. See the module doc for the steps. - window_
counts 🔒 - The windows a record holds, open and closed.
- window_
patch 🔒 - The meta patch that makes a window the one a record entry describes: its name, theme and opacity, and none of the window’s own where the entry has none.