ManualWorkspace
Workspaces and chan serve
Register a directory as a workspace, choose where chan serve runs it, turn it on or off, and list, close, or forget it.
What you can do
- Turn any directory into a workspace with
chan open .or the New workspace button. - Search it, browse its graph, and run agent teams in it, beside its terminals.
- Keep each workspace's windows, panes, and tabs, across restarts of Chan Desktop.
- Hand a workspace to Chan Desktop or a devserver from any shell, or serve it on its own to a browser.
- Turn a workspace off to end its terminals, and on again with its index and layout intact.
- See which workspaces are served, and by what, with
chan ps.
What a workspace is
A workspace is a directory registered with chan. Its files stay ordinary files. Any directory can be one; a git repository is a good first try.
| In a window of | Standalone terminal | Workspace |
|---|---|---|
Terminals and cs | Yes | Yes |
| File browser and editor | The whole machine | The workspace directory |
| Search and the graph | No | Yes: the content is indexed, and links, tags, and mentions make the graph |
Agent teams and cs export | No | Yes |
| Dashboard | Metrics and About | Metrics, Workspace, Search, and About |
A workspace window's pane menu lists its apps: dashboard, diagram, draft, file browser, graph, slide deck, team, and terminal. Each workspace keeps its own windows, panes, and tabs, and Chan Desktop restores them at its next launch.
Open a workspace
In a Chan terminal, from the directory:
$chan open .| Way | What it does |
|---|---|
chan open PATH | Registers PATH and serves it. A missing directory is created first. |
chan open PATH --here | Opens a subdirectory of a repository as a workspace of its own. Without --here, a path inside a Git, Mercurial, or Subversion working tree is refused, and the message names the repository root. |
| New workspace on a computer's card in Computers | Asks for a folder path (Browse... on the desktop) and an optional display name, then Create workspace. |
chan workspace add PATH | Registers PATH without serving it. |
chan open PATH --on NAME | Opens a path on a connected devserver. See Remote workspaces. |
What chan serve does
chan open is another name for chan serve. One process serves a workspace at a time, so the command first looks for a Chan Desktop or devserver of yours that can take it.
| Run it in | It |
|---|---|
| A Chan Desktop terminal | Hands the workspace to Chan Desktop, which opens it in a window, and exits. |
| A devserver terminal | Registers it with that devserver, with a window ready to open from the devserver's Computers screen, and exits. |
| Any other shell, with Chan Desktop or a devserver running | Hands it to the one that is running, and exits. |
| Any other shell, with neither running | Serves it itself on 127.0.0.1:8787 behind a token, opens your browser on the URL, and runs until Ctrl+C. |
--standalone always serves it here, and --desktop or --devserver picks the receiver. The standalone server's flags and its token are on Chan in a browser.
Where its state lives
chan writes what it derives from a workspace under the chan home, ~/.chan, never inside the directory. Set CHAN_HOME to use another directory instead.
| What | Where, under the chan home |
|---|---|
| The registered workspaces | config.toml |
| Which workspaces are on | workspaces.json; a devserver's is devserver/workspaces.json |
| Search index, graph, code reports, saved layouts, drafts, trash, and the access token | workspaces/KEY/, one directory per workspace. chan workspace ls prints each key. |
Turn a workspace on or off
Each workspace is a row under Workspaces on its computer's card in the Computers screen. On means served: indexed, watched, and ready for windows. Off means registered but not served.
| Row button | Key, on the selected row | What it does |
|---|---|---|
| New window | w | Opens a window of the workspace. |
| New terminal window | t | Opens a window with a terminal in the workspace. |
| Power | o | Turns the workspace off or on. |
Turning a workspace off:
- Ends its terminals. When any are running, chan asks first.
- Keeps its index, its windows, and their layout for when it is on again.
- Lasts: an off workspace stays off when Chan Desktop or the devserver restarts.
List, close, and forget
| Command | What it does |
|---|---|
chan ps | Lists every registered workspace and what serves it: standalone, desktop, devserver, or nothing (free). --json prints it for scripts. |
chan workspace ls | Lists the registered workspaces, most recent first, with each one's key. Also takes --json. |
chan close PATH | Stops serving the workspace and keeps it registered, so chan open brings it back. |
chan workspace forget PATH | Stops serving it, unregisters it, and deletes its state under the chan home. Your files stay. chan close --forget PATH is the same. |
STATE BY PID READY GEN PASS ACTION INDEXER QUEUE WORKSPACE
served desktop 41873 - - - - - - /home/user/notes
free - - - - - - - - /home/user/archive
Details and limits
- From a plain shell with both Chan Desktop and a devserver running, a
chaninstalled on its own picks the devserver, and thechanthat Chan Desktop installs picks Chan Desktop. - With neither running, the
chanthat Chan Desktop installs starts Chan Desktop and opens the workspace there, on macOS and Linux, except over ssh. - A running Chan Desktop of another release cannot take a workspace, nor, on Windows, one still starting;
chan servesays so and serves it itself. - With several devservers running,
--devserver=PORTnames one. - When Chan Desktop restarts, windows and layouts come back and local shells start fresh.
- A row shows both states when they disagree, such as Off, running for a workspace something else is serving.
- A lock in place of the power button means another chan process, such as a
chan servein a terminal, holds the workspace. - A workspace on a network filesystem that stops answering reads
unavailable; open documents keep their text, and it recovers when the directory comes back. - A directory deleted or replaced while its workspace is on stays broken until you turn the workspace off and on.
- With the Computers screen's checks showing, several workspaces turn on or off together; Remove unregisters them and leaves their files alone.
- Chan Desktop and devservers refuse to close or forget a workspace with live terminals, with no override; close the terminals first.
- A foreground
chan servehas no such guard: Ctrl+C orchan closeends its terminals, and files, index, and layout stay. - The answer
workspace is still releasing; retry, with exit status 75, means the workspace is off and its cleanup is still running; run the command again later. - Forgetting cannot be undone: the index, graph, trash, and layouts go, and opening the path again starts from empty.
--on NAMEreaches a workspace on a connected devserver forchan closeandchan workspace forgetas well.chan psfills READY through QUEUE only for workspaces the local devserver serves; other rows show-there.