Files
chuan 394c828ace fix: make statusline work cleanly on Linux too
- install: only convert backslashes to slashes on Windows (backslash is a valid char in Unix paths)
- config dir resolution already falls back from USERPROFILE to HOME, covering both platforms
- README: cross-platform build/install instructions, recommend the install command
2026-06-25 19:13:47 +08:00

43 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# statusline
## 显示内容
| 组 | 示例 | 说明 |
|---|---|---|
| 模型 + 思考 | `H opus-4.8` | 思考等级(L/M/H/XH)+ 模型名;等级按高低绿→红配色 |
| 上下文 | `8.9%` | 已用上下文百分比,按用量绿→红渐变(80% 纯红) |
| 目录 | `project` | 在项目根显示目录名,否则显示末两级 `parent/current` |
| Git | `main ~15 +595` | 分支 + 改动文件数 + 增删行数(为 0 不显示) |
| 速度 | `↑ 1.2k ↓ 134.4 t/s` | 最近 8 次请求的输入/输出 token 速度 |
| 额度 | `10% - 40% · 1:45` | 5h 已用 - 7 天已用 · 5h 刷新倒计时(越近越红) |
## 构建
```bash
cargo build --release
# 产物:Linux/macOS 为 target/release/statuslineWindows 为 target/release/statusline.exe
```
## 接入 Claude Code
推荐用内置 `install` 命令,自动定位配置目录、把 `statusLine.command` 指向当前可执行文件(跨平台,含空格的路径自动加引号):
```bash
./target/release/statusline install # 用户级:CLAUDE_CONFIG_DIR 或 ~/.claude
./target/release/statusline install project # 项目级:./.claude/settings.json
./target/release/statusline install local # 项目本地:./.claude/settings.local.json
```
或手动编辑 `settings.json`(路径含空格时用引号包裹):
```json
{
"statusLine": {
"type": "command",
"command": "/abs/path/to/statusline"
}
}
```
> 需要倒计时/速度持续刷新,可加 `"refreshInterval": 10`(单位秒)。