Skip to content

labels: reflect pane-title (rename / command) changes in real time #75

Description

@GeneralD

type complexity area needs

Motivation

The minimap labels are sourced from each pane's title (pane.title, src/projection.rs:43) — usually the running command, or a user renamepane. When that title changes, the label should update in real time, without waiting for an unrelated event (a split, a focus change, a tab switch) to trigger the next repaint.

The plugin side already does the right thing unconditionally: the PaneUpdate handler stores the new manifest and returns true to force a repaint, with no dedup/throttle (src/lib.rs:158-160). So whether labels update live comes down to one question about zellij's event delivery: does a title-only change emit a PaneUpdate at all?

Investigation (do this first)

Verify, on a live session, whether each of these triggers a PaneUpdate (and therefore a label repaint) on its own:

  1. Manual renamepane (enter rename mode, type a new name, commit).
  2. Program-driven title change — a process emitting an OSC 0 / OSC 2 title escape (e.g. a shell prompt that sets the terminal title, printf '\033]2;newtitle\007', vim editing a file).
  3. Command change without rename — running a new foreground command so the pane's reported title flips (e.g. nvim -> shell -> cargo).

Use the headless verification harness (eprintln oracle in update() + expect PTY) from .claude/rules/zellij-plugin-development.md to log when PaneUpdate arrives and what title it carries, then correlate with each trigger above.

Outcomes

  • If PaneUpdate already fires on title-only changes — labels are already live; close this after documenting the evidence (and add a regression note / test fixture so it stays that way).
  • If it does NOT fire for some triggers (likely for OSC-driven title changes) — the manifest the plugin holds goes stale and the label lags. Then evaluate a workaround:
    • A periodic refresh via set_timeout to repaint on the latest known manifest (only helps if the manifest itself is refreshed — confirm whether a timer-driven render() sees updated titles, since pane data is push-only via PaneUpdate).
    • Subscribe to any additional event that does carry the title change.
    • If neither is possible from the plugin API, document it as a zellij-side limitation (link the upstream issue) rather than shipping a busy-loop.

Done when

  • Documented evidence for each of the three triggers above (fires / does not fire).
  • For every trigger that a plugin can react to, the minimap label updates within one repaint, with no unrelated event needed.
  • No busy-loop / fixed-interval polling shipped just to paper over a missing event — any timer is justified by the investigation.
  • cargo clippy --target wasm32-wasip1 --lib clean and cargo test --lib passes on the native host.

Relevant code

  • src/projection.rs:43 — label source: pane.title.clone() into PaneRect.
  • src/lib.rs:158-160PaneUpdate handler: stores manifest, returns true (unconditional repaint, no dedup).
  • src/lib.rs:135 — subscription set (TabUpdate, PaneUpdate, ModeUpdate, Mouse, PermissionRequestResult).
  • .claude/rules/zellij-plugin-development.md — headless verification harness for confirming event delivery.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrenderingMinimap / color / label rendering

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions