Skip to content

Commit bb8c1d6

Browse files
authored
Merge pull request #26 from narumiruna/fix/caffeinate-statusline-awake
fix(caffeinate): hide inactive statusline entry
2 parents cf28534 + 34f02be commit bb8c1d6

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

extensions/pi-caffeinate/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ It is designed for long-running coding, refactoring, debugging, web research, an
1010

1111
- Starts an OS sleep inhibitor when Pi begins processing (`agent_start`).
1212
- Releases the inhibitor when processing ends (`agent_end`) or the session shuts down.
13+
- Publishes an `awake` status only while an inhibitor is active.
1314
- Supports macOS, Windows, WSL, and Linux.
1415
- Provides `/caffeinate-status` and `/caffeinate-stop` commands.
1516
- Allows a custom inhibitor command through environment configuration.

extensions/pi-caffeinate/src/caffeinate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ function isWsl() {
279279

280280
function updateStatus(ctx: ExtensionContext) {
281281
if (state.disabled) {
282-
ctx.ui.setStatus(STATUS_KEY, "caffeinate: disabled");
282+
ctx.ui.setStatus(STATUS_KEY, undefined);
283283
return;
284284
}
285285

286286
if (state.process) {
287-
ctx.ui.setStatus(STATUS_KEY, `caffeinate: on (${state.command?.description ?? "active"})`);
287+
ctx.ui.setStatus(STATUS_KEY, "caffeinate: awake");
288288
return;
289289
}
290290

@@ -293,7 +293,7 @@ function updateStatus(ctx: ExtensionContext) {
293293
return;
294294
}
295295

296-
ctx.ui.setStatus(STATUS_KEY, "caffeinate: idle");
296+
ctx.ui.setStatus(STATUS_KEY, undefined);
297297
}
298298

299299
function describeState() {

extensions/pi-statusline/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Statuses from other extensions, such as goal mode, appear on their own compact i
5555
Examples:
5656

5757
- `🎯 active` for goal mode.
58+
- `💊 awake` while pi-caffeinate is preventing sleep.
5859
- `🧬 ✓` for Biome LSP readiness.
5960
- `🐍 ty ✓ ruff ✓` for Python LSP readiness.
6061
- `🧑‍🤝‍🧑 2 parallel` while subagents are active.

extensions/pi-statusline/src/statusline.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ function extensionIcon(key: string): string {
452452
if (normalizedKey.includes("python") || normalizedKey.includes("ruff") || normalizedKey.includes("ty"))
453453
return "🐍";
454454
if (normalizedKey.includes("subagent")) return "🧑‍🤝‍🧑";
455-
if (normalizedKey.includes("caffeinate")) return "";
455+
if (normalizedKey.includes("caffeinate")) return "💊";
456456
if (normalizedKey.includes("chrome") || normalizedKey.includes("devtools") || normalizedKey === "cdp")
457457
return "🌐";
458458
if (normalizedKey.includes("codex")) return "📊";
@@ -464,9 +464,9 @@ function extensionIcon(key: string): string {
464464

465465
function extensionColor(key: string, value: string): ThemeColor {
466466
const normalized = `${key} ${value}`.toLowerCase();
467-
if (/missing|error|fail|conflict|duplicate/.test(normalized)) return "warning";
467+
if (/missing|error|fail|conflict|duplicate|unavailable/.test(normalized)) return "warning";
468468
if (normalized.includes("codex")) return "accent";
469-
if (/ready|active|running|enabled|ok/.test(normalized)) return "success";
469+
if (/ready|active|running|enabled|awake|ok/.test(normalized)) return "success";
470470
return "muted";
471471
}
472472

0 commit comments

Comments
 (0)