Skip to content

Conditional widget visibility (e.g. per-model hide/show) #611

Description

@axisrow

Feature: conditional widget visibility (e.g. show/hide widgets depending on the model)

Problem. The status line is one static widget list per line, but the meaningful widgets depend on the active model. Concrete case: running Claude Code against a non-Anthropic backend (e.g. a GLM model through a proxy) — the Anthropic limit widgets (Session Usage, Weekly Usage, Block/Weekly Reset Timers, Extra Usage) render S:0.0% 4h21m W:100.0% 0m with data that is meaningless or misleading for that model, and there is no way to hide them just for those models. Today the only choices are removing the widgets entirely or hiding them manually each time.

Proposal. A per-widget visibility condition matched against the model from the status line payload (model.id / model.display_name), via two metadata keys:

  • hideForModels: "glm-*" — hide the widget when the model matches any pattern;
  • showForModels: "claude-*" — show the widget only when the model matches (hide otherwise).

Patterns are comma-separated globs, case-insensitive, matched against both id and display_name. When the payload has no model info (e.g. TUI preview), the widget stays visible, so previews are unaffected.

Example — hide the Anthropic usage widgets for GLM models without touching anything else:

{ "type": "session-usage", "metadata": { "hideForModels": "glm-*" } }

Because visibility is decided before rendering (empty pre-render content), existing separator collapsing already handles the gap: neighboring separators disappear together with the hidden widget instead of leaving double gaps.

Fitting it next to the existing per-widget hide metadata (hideable states) seems natural — this is essentially the same mechanism with a dynamic condition instead of a static state.

Happy to send a PR if the approach looks welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions