Skip to content

Data Flow

Note

Five flows carry data through the shell: loading a shell, live module data, hot reload, monitor hot-plug and user input. Each starts in a named component of Layers and Components, crosses threads only through call_soon (Process Model and Threading), and ends in a tre node. The diagrams are proposals built on the accepted ADRs; where an ADR decides a step, the step cites it.

Loading a Shell

flowchart TD
    a[Find shell files in the config directory] --> b[Parse TDL and check the metadata block, TDL, Name and the root block against the suffix]
    b --> c[Follow Import and nest]
    c --> d[Check or write registry and UID]
    d --> e[Resolve name references through registry]
    e --> f[Compile TEL expressions]
    f --> g[Read outputs and match Monitor blocks]
    g --> h[Build the shell model]
    h --> i[Open one window per surface per monitor]
    i --> i2[Bind to tre: build each subtree detached, link slots, attach]
    i2 --> j[Start modules]
Step Decided by Failure
Files, metadata block, root block TDL Language > The Metadata Block, TDL Language > The Root Block, ADR-0014 Shell File Language > Second-Sketch Decisions (2026-10-30) A file without the block, TDL:, Name: or exactly one root block is refused and named; a root block that disagrees with the suffix is a load error naming both
Import and nesting ADR-0007 Shell UI Layer > Recognising a shell file and importing (2026-10-25) Cycle, missing file or a name registered twice (a user module overrides a shipped one): load error with file:line:column
Registry and UID ADR-0007 Shell UI Layer > Config directory and registry (2026-10-25) A mismatch registers a new entry; an unresolved reference is an error at load
TEL compile ADR-0008 Tesserae Expression Language Error with file, line and column inside the TDL file
Monitor matching V1 Scope > Multi-monitor, TDL Language > Monitors (Shell Schema) A Monitor with no selector is ignored; Index: default covers monitors no other Monitor names
Bind to tre ADR-0015 Render Binder (proposed) A value tre refuses is reported with the file:line:column of the key; the surface stays empty and the others open
Module start ADR-0007 Shell UI Layer > Module Python (2026-10-25) A module with no matching .py is a load error naming both files

Live Module Data

The hand-off is decided (ADR-0007 Shell UI Layer > Module data reaches the view through shell entry points (2026-10-25)): the module sends values to shell entry points, the shell converts what it can, and the renderer updates. The sequence diagram is in Process Model and Threading > Handing a value to the loop (proposed).

What the diagram adds to the ADR (proposals):

  • A value store holds the latest value per module and key.
  • TEL records the names each expression read, so a changed value re-runs only the expressions that read it.
  • A re-evaluated expression sets a node property with node.set(...); tre redraws only what changed.
  • Static expressions (no live names) are evaluated once at load.

Hot Reload

sequenceDiagram
    participant W as Watcher thread
    participant L as Loop thread
    participant T as tre
    W->>W: file changed, read and parse, compile TEL
    alt parse or TEL error
        W->>L: call_soon(report error)
        L->>L: keep old state, log file:line:column
    else valid
        W->>L: call_soon(apply new model)
        L->>L: diff against current model
        L->>T: set() live keys, reopen window for constructor-only keys
    end

Monitor Hot-plug

sequenceDiagram
    participant C as KWin
    participant T as tre
    participant S as Surface manager
    participant M as Shell model
    C->>T: output added or removed
    T->>S: output_added or output_removed (loop thread)
    alt added
        S->>M: match Monitor blocks by connector, description, index, default
        S->>T: create windows for that monitor
    else removed
        T->>S: windows closed, reason output_removed
        S->>M: drop that monitor's surfaces (windows are dead)
    end

User Input

A pointer or key event reaches a tre node on the loop thread. Events belong to the shell, not to TEL (decided 2026-10-26, ADR-0007 Shell UI Layer > Events and module reload (2026-10-26)). A shell file maps an event to a module method or a shell action. TEL only evaluates the argument expressions when the event fires (for example a value taken from the event). The vocabulary is set in the TDL reference (folder 41 TDL Reference/).

  • A module method that does slow work hands it to the module's thread and returns at once.
  • Window actions (close, dismiss a popup) are shell-provided.
  • A handler may set a value in the shell's store (a local state) or call a module method.

Notes

  • The handler vocabulary for input is the shell's, set in the TDL reference (folder 41 TDL Reference/), not TEL's.

Open Questions

  • Where does the value store sit, and how is a module's last value kept across a reload? Context: the store holds the latest value per module and key; a module reload stops the old instance and imports new code. Recommendation: the store lives in the shell model (model/, as in TEL Integration), and a reload keeps the stored values until the new instance sends its own, so widgets do not blank during the reload.
  • A module's .py can be reloaded at runtime (maintainer, 2026-10-26). Mechanics are proposed above.
  • How the diff of a reload works: by identity (file UID), then name, then position (proposed in Hot Reload > The diff).
  • What does output_updated do to surfaces whose size depends on the output? Context: today it keeps the surfaces and re-evaluates only the match rules. Recommendation: re-evaluate the size of those surfaces on output_updated and apply it live through set().