Skip to content

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 ofStandalone terminalWorkspace
Terminals and csYesYes
File browser and editorThe whole machineThe workspace directory
Search and the graphNoYes: the content is indexed, and links, tags, and mentions make the graph
Agent teams and cs exportNoYes
DashboardMetrics and AboutMetrics, 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 .
WayWhat it does
chan open PATHRegisters PATH and serves it. A missing directory is created first.
chan open PATH --hereOpens 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 ComputersAsks for a folder path (Browse... on the desktop) and an optional display name, then Create workspace.
chan workspace add PATHRegisters PATH without serving it.
chan open PATH --on NAMEOpens 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 inIt
A Chan Desktop terminalHands the workspace to Chan Desktop, which opens it in a window, and exits.
A devserver terminalRegisters 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 runningHands it to the one that is running, and exits.
Any other shell, with neither runningServes 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.

WhatWhere, under the chan home
The registered workspacesconfig.toml
Which workspaces are onworkspaces.json; a devserver's is devserver/workspaces.json
Search index, graph, code reports, saved layouts, drafts, trash, and the access tokenworkspaces/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 buttonKey, on the selected rowWhat it does
New windowwOpens a window of the workspace.
New terminal windowtOpens a window with a terminal in the workspace.
PoweroTurns 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

CommandWhat it does
chan psLists every registered workspace and what serves it: standalone, desktop, devserver, or nothing (free). --json prints it for scripts.
chan workspace lsLists the registered workspaces, most recent first, with each one's key. Also takes --json.
chan close PATHStops serving the workspace and keeps it registered, so chan open brings it back.
chan workspace forget PATHStops 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 chan installed on its own picks the devserver, and the chan that Chan Desktop installs picks Chan Desktop.
  • With neither running, the chan that 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 serve says so and serves it itself.
  • With several devservers running, --devserver=PORT names 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 serve in 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 serve has no such guard: Ctrl+C or chan close ends 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 NAME reaches a workspace on a connected devserver for chan close and chan workspace forget as well.
  • chan ps fills READY through QUEUE only for workspaces the local devserver serves; other rows show - there.

Next