---
title: "desktop-statusline"
url: "https://claudemods.dev/zh-tw/builds/desktop-statusline-f29abe"
source: "https://github.com/centminmod/claude-plugins/tree/master/plugins/desktop-statusline"
source_type: "github"
repo: "https://github.com/centminmod/claude-plugins/tree/master/plugins/desktop-statusline"
author: "centminmod"
author_handle: "centminmod"
stars: 19
category: "儀表板與 HUD"
categories: ["hud"]
tags: ["context-meter", "desktop", "git", "hud", "plugin", "statusline", "usage-limits"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add centminmod/claude-plugins\nclaude plugin install desktop-statusline@centminmod"
added: "2026-10-05T18:28:54.074Z"
updated: "2026-11-23T09:30:10Z"
locale: "zh-tw"
content_locale: "zh-tw"
---

# desktop-statusline

Claude Code 外掛，在 Claude Desktop app 的 Code 分頁中於提示列上方繪製狀態帶，顯示資料夾、git 分支與狀態、工作階段時間、提示次數與費用、上下文計量、5 小時與每週用量上限及重設倒數、上一輪統計、相對於 prompt-cache TTL 的閒置時間、壓縮次數和執行中的代理。

## Description

desktop-statusline 讀取 CLI statusLine 腳本在 Claude Code 內會使用的同一份工作階段資料，並在 CLI statusLine 腳本不會執行的桌面 Code 分頁中繪製。它顯示目前位置（資料夾、git 分支、worktree 標記、領先/落後的提交數、未提交檔案數），右側顯示工作階段時間、提示次數與費用；也顯示上下文視窗計量、帶重設倒數的 5 小時與每週方案用量上限，以及上一輪詳細資料（時間、模型、快取命中率、閒置時間，超過 prompt-cache TTL 時顯示快取已冷卻警告，壓縮前後 token 與壓縮次數）。最多三個執行中的子代理各有一列，接著顯示「還有 +N 個代理正在執行」；每個上限視窗達到 80% 和 95% 時各顯示一次通知。它只在桌面端運作：終端工作階段不繪製任何內容，也跳過 git 呼叫，不影響 CLI statusLine。它唯一執行的程式是 git，在工作階段資料夾中執行兩個固定的唯讀命令（git status --porcelain=v2 --branch 和 git rev-parse --git-dir --git-common-dir），逾時為 5 秒；不發出網路請求，也不寫檔。透過 /plugin marketplace add centminmod/claude-plugins，再執行 /plugin install desktop-statusline@centminmod 安裝。需要 Claude Code v2.1.287 或更新版本，以及更新的桌面應用程式。cache_ttl 設定（預設 1h，也可設 5m）控制狀態帶何時標記提示快取已冷卻。MIT 授權。

## Install

```
claude plugin marketplace add centminmod/claude-plugins
claude plugin install desktop-statusline@centminmod
```

## Original README

# desktop-statusline

**A Claude Code mod that puts a status band above the prompt in the Claude
Desktop app's Code tab.**

The Claude Code CLI has a `statusLine` setting that runs a script and prints
its output under the prompt. The desktop Code tab never runs that script, so
desktop sessions show none of it. This mod reads the same session data from
inside Claude Code and draws it in the desktop app instead.

![The desktop-statusline band above the prompt in the Claude Desktop app's Code tab, showing folder, branch, changed files, session cost, context meter, 5-hour and weekly usage limit meters, and last-turn stats](images/desktop-statusline.png)

- Desktop only. In a terminal session it draws nothing and skips its git
  calls, so your CLI `statusLine` keeps working as before.
- No network calls. The only process it starts is `git`, in the session's
  folder.
- Works on any plan. The usage limit meters appear when Claude Code reports
  plan limits for your account.

---

## What it shows

Four lines on a normal window. On a narrow window the two limit meters stack,
which makes five.

1. **Where you are.** Folder, git branch, a 🌳 marker in a worktree, commits
   ahead or behind upstream, and the number of uncommitted files. Right-aligned
   on the same line: session age, prompt count, and session cost.
2. **Context.** A meter for how full the context window is, with tokens used
   against the window size.
3. **Plan usage limits.** The 5-hour and weekly limits, each with a meter and
   a reset countdown.
4. **Last turn.** How long it took, the model that answered, the cache hit
   rate, how long the session has been idle, and how many times it has
   compacted, with the token count before and after the last compaction.

Each running subagent gets a row of its own, up to three, followed by a
`+N more agents running` line.

Meters turn amber at 80% and red at 95%. A cache hit rate under 50% shows as a
warning, and so does an idle time past the prompt-cache TTL, marked
`(cache cold)`. A toast pops up when a usage limit crosses 80% and again at
95%, once per limit window.

## Install

Mods need Claude Code v2.1.287 or later. The desktop app ships its own copy of
Claude Code, so keep the app updated too.

Run these inside the Claude Code terminal CLI (`claude` in your shell):

```
/plugin marketplace add centminmod/claude-plugins
/plugin install desktop-statusline@centminmod
```

Then start a new session in the desktop app's Code tab. The band appears once
the session has data to show, usually right away.

## Settings

One setting, `cache_ttl`, sets how long your session can sit idle before the
band marks the prompt cache cold. Claude Code asks for it when you enable the
plugin, and you can change it later in `/plugin` or `/config`. Enter `1h` or
`5m`; any other value counts as `1h`.

Claude Code's [prompt caching docs](https://code.claude.com/docs/en/prompt-caching#cache-lifetime)
give these defaults for the main conversation:

| Account | Default TTL | Set `cache_ttl` to |
| :- | :- | :- |
| Claude subscription, within plan usage | 1 hour | `1h`, the default |
| API key, cloud provider, or a subscription drawing on usage credits | 5 minutes | `5m` |

A `promptCacheTtl` setting or the `CLAUDE_CODE_PROMPT_CACHE_TTL` environment
variable overrides those defaults, so match whatever you set there. The docs
don't split Pro from Max. If you're not sure which TTL you get, run this and
look at `usage.cache_creation` in the output:

```bash
claude -p "hello" --output-format json
```

One-hour cache writes count under `ephemeral_1h_input_tokens`, five-minute
writes under `ephemeral_5m_input_tokens`.

Claude Code stores your answer in `~/.claude/settings.json`:

```json
{
  "pluginConfigs": {
    "desktop-statusline@centminmod": {
      "options": { "cache_ttl": "5m" }
    }
  }
}
```

See [Cache lifetime](https://code.claude.com/docs/en/prompt-caching#cache-lifetime)
for which TTL your sessions get.

## When it updates

The band refreshes when the session starts, when the desktop app attaches,
after every turn, when a plan limit's percentage changes, two seconds after
Claude starts a subagent, and every 60 seconds.

## What it runs, reads and sends

**Programs it runs.** Only `git`, with two fixed read-only commands, in the
session's folder and with a 5-second timeout:

- `git status --porcelain=v2 --branch`, for the branch, commits ahead or
  behind upstream, and the uncommitted file count
- `git rev-parse --git-dir --git-common-dir`, to tell a worktree from the main
  checkout

Neither command contacts a remote, and the mod runs them only in desktop
sessions. It starts no other program.

**What it reads.** Through Claude Code's mods API, it reads the session's
usage (context size, cost, and the 5-hour and weekly plan limits), the
session's folder, the number of prompts, the start time, and the type and
short task description of each running subagent. From each finished turn it
reads the duration, the model, and the token counts used for the cache hit
rate. After a compaction it reads the token counts before and after. It
doesn't read prompt or response text, files, environment variables, or
credentials. The plan limits come from Claude Code, not from your login.

**What it sends.** Nothing. It makes no network calls and writes no files.
What it reads goes only into the band above the prompt and the usage-limit
toasts, and into the session's `$.state`, which ends with the session.

The one URL in the code, `http://www.w3.org/2000/svg`, is the standard SVG
namespace in the meter bars' `xmlns` attribute. It labels the markup as SVG
and is never fetched. The token counts next to it are the context and
compaction sizes the band displays, not API keys or login tokens.

**What its hooks change.** Nothing. The `session.compact` hook waits for the
compaction to finish, records the before and after token counts, and returns
the result unchanged. The `tool.call` hook for the Agent tool schedules a band
refresh two seconds later and passes the call through unchanged.

## Check it yourself

Before installing a mod, you can list what it hooks and calls without running
it. Clone this repo and run:

```bash
claude plugin validate plugins/desktop-statusline
```

For this mod the report lists:

- **Hooks**: `session.start`, `session.attach` for the desktop,
  `session.measure`, `turn.complete`, `tool.call` for the Agent tool only,
  `session.compact`, and `ui.render` for the `AbovePrompt` band.
- **Calls**: session usage, cwd and turn count, the running agent list, the
  clock, toasts, and `$.process.run` for `git status --porcelain=v2 --branch`
  and `git rev-parse --git-dir --git-common-dir`.

It keeps its values in the session's `$.state` and writes no files.

## Limitations

- **No lines added or removed.** The mods API doesn't expose them, so the band
  shows the uncommitted file count instead.
- **The cache-cold warning follows your setting, not your account.** Claude
  Code drops to the 5-minute TTL when a subscription starts drawing on usage
  credits, and the band keeps using whatever `cache_ttl` says.
- **No effort level or permission mode.** The desktop app's footer already
  shows both.
- **Nothing draws in the VS Code extension, `claude -p`, or cloud sessions.**
  Mods only draw in the terminal and the desktop Code tab, and this one only
  draws in the desktop.

## Turn it off

Disable it from the **Installed** tab in `/plugin`, or uninstall it from your
shell:

```bash
claude plugin uninstall desktop-statusline@centminmod
```

## Licence

MIT. See [`LICENSE`](LICENSE).
