# tui/save Save the current workspace layout as a declarative spec to ~/.deft/workspaces/<name>.dft. ## Syntax
[tui/save]
## Returns bool ## Saved format The saved workspace is a declarative spec (`%{ ... }`) with nested panel descriptions. Each node may include: | Key | Description | |-----|-------------| | `:app "name"` | App name to launch | | `:package "owner/name"` | Portable package reference (saved for packaged apps) — preferred on load | | `:source "path"` | Path to app source file — saved for apps outside a package; may be added by hand as a fallback | | `:id "tag"` | Tag name for referencing the panel | | `:focus true` | Panel receives keyboard focus on load | | `:maximise true` | Leaf: maximised (siblings collapsed). Group: fills the workspace (every node outside the group collapses) | | `:collapsed true` | Leaf or group is minimised — collapsed to its title bar — on load | | `:toggle-visibility "key"` | Key binding to toggle panel visibility | Apps launched from a package save only the `:package` reference; it resolves across dev checkouts, `:pkgs` roots, and installed layouts (the same resolution the launcher and `deft compile --app` use). Add a `:source` path by hand when a fallback is wanted — loading tries the package first and falls back to the path. Top-level metadata: `:title`, `:theme "<name>"`, `:vars %{ ... }`, and `:font %{ :family "..." :cut :regular :size n }` — the applied font, restored on load (CLI `--font`/`--size` stay authoritative per field). The save records the portable family + cut, so the workspace loads on any distro; only a face reporting no family falls back to a resolved `:path`. ## Workspace templates (global workspaces) The Workspace menu (bottom-left taskbar button) also offers: - Make Template — copy the current workspace spec to the user-level templates directory, `<user home>/workspaces` (`$DEFT_HOME` or `~/.deft`). Re-publishing with the same name overwrites the template. Untitled workspaces are asked for a name via the save dialog first. - Use Template ▸ — list the user-level templates; selecting one copies it into the project's `.deft/workspaces/` (source wins over a same-named local file) and switches to it. Templates are ordinary workspace specs: apps are stored as portable `:package "owner/name"` references and resolve through the target project's prelude `:pkgs` roots. The intended flow is to publish a layout you like, reuse it in another project, then tweak the copy there without touching the template. Both entries appear only in project sessions (a rootless session's workspace directory already is the user-level one) and are disabled under lockdown. The keyboard path is the same menu: open the Workspace button, move to the entry, Enter. The ANSI host uses the themed save dialog for the template name; retro uses its SDL save dialog.