diff --git a/web/src/catalog.ts b/web/src/catalog.ts
index 3adc557..f6f2d92 100644
--- a/web/src/catalog.ts
+++ b/web/src/catalog.ts
@@ -116,7 +116,10 @@ function renderNode(node: TreeNode, depth: number): HTMLElement {
header.setAttribute("aria-expanded", String(!isCollapsed));
// Single down-chevron; CSS rotates it -90° (→ right) when collapsed, so the
// glyph and the rotation never fight each other.
- header.innerHTML = `▾${escapeHtml(node.name)}${countLeaves(node)}`;
+ // A deep path (`~/git.naps.pt/naps62/maestro`) collapses its leading
+ // segments to initials (`~/g/n/maestro`) so the dir name stays readable in
+ // a narrow sidebar; the full path lives in the tooltip.
+ header.innerHTML = `▾${abbreviateFolderName(node.name)}${countLeaves(node)}`;
header.addEventListener("click", () => {
if (collapsed.has(node.path)) collapsed.delete(node.path);
else collapsed.add(node.path);
@@ -185,6 +188,21 @@ function countLeaves(node: TreeNode): number {
return node.children.reduce((n, c) => n + countLeaves(c), 0);
}
+/** `~/git.naps.pt/naps62/maestro` → `~/g/n/maestro`: keep the last segment
+ * verbatim, collapse every earlier one to its first character. Two-or-fewer
+ * segments are left alone (nothing to gain). Returns escaped HTML with the
+ * collapsed stem wrapped so CSS can dim it. */
+function abbreviateFolderName(name: string): string {
+ const parts = name.split("/");
+ if (parts.length <= 2) return escapeHtml(name);
+ const last = parts[parts.length - 1];
+ const stem = parts
+ .slice(0, -1)
+ .map((p) => (p === "~" ? "~" : Array.from(p)[0] ?? ""))
+ .join("/");
+ return `${escapeHtml(stem)}/${escapeHtml(last)}`;
+}
+
function escapeHtml(s: string): string {
return s
.replace(/&/g, "&")
@@ -197,20 +215,12 @@ function renderStatusbar(daemons: DaemonInfo[], sessions: Session[]): HTMLElemen
const wrap = document.createElement("div");
wrap.className = "statusbar";
- const total = sessions.length;
- const live = sessions.filter((s) => s.status === "Running").length;
- const tally = document.createElement("div");
- tally.className = "session-tally";
- tally.innerHTML =
- total === 0
- ? `No sessions`
- : `${total} session${total === 1 ? "" : "s"}` +
- `${live} live`;
- wrap.appendChild(tally);
-
- const spacer = document.createElement("div");
- spacer.className = "spacer";
- wrap.appendChild(spacer);
+ // Per-host session counts replace the old global "N sessions / N live" tally:
+ // each daemon chip carries its own green count, so the tally was redundant.
+ const counts = new Map();
+ for (const s of sessions) {
+ counts.set(s.daemon_id, (counts.get(s.daemon_id) ?? 0) + 1);
+ }
const daemonsWrap = document.createElement("div");
daemonsWrap.className = "daemons";
@@ -218,10 +228,13 @@ function renderStatusbar(daemons: DaemonInfo[], sessions: Session[]): HTMLElemen
daemonsWrap.innerHTML = `no daemons connected`;
} else {
for (const d of daemons) {
+ const n = counts.get(d.daemon_id) ?? 0;
const chip = document.createElement("span");
chip.className = "daemon-chip";
- chip.title = `${d.hostname} · ${d.daemon_url}`;
- chip.textContent = d.daemon_id;
+ chip.title = `${d.hostname} · ${d.daemon_url} · ${n} session${n === 1 ? "" : "s"}`;
+ chip.innerHTML =
+ `${escapeHtml(d.daemon_id)}` +
+ `${n}`;
daemonsWrap.appendChild(chip);
}
}
diff --git a/web/src/styles.css b/web/src/styles.css
index f0d2f14..663ea77 100644
--- a/web/src/styles.css
+++ b/web/src/styles.css
@@ -618,34 +618,6 @@ textarea {
color: var(--muted);
}
-.session-tally {
- display: inline-flex;
- align-items: center;
- gap: var(--sp-2);
- color: var(--ink);
- font-size: var(--fs-13);
-}
-
-.session-tally b {
- font-weight: 600;
-}
-
-.tally-live {
- display: inline-flex;
- align-items: center;
- gap: 5px;
- color: var(--accent);
-}
-
-.tally-live::before {
- content: "";
- width: 7px;
- height: 7px;
- border-radius: 50%;
- background: var(--live);
- box-shadow: 0 0 6px var(--live-glow);
-}
-
.statusbar .spacer {
/* zero basis: claim leftover space without inflating the bar's min width */
flex: 1 1 0;
@@ -668,7 +640,7 @@ textarea {
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--r-pill);
- padding: 3px var(--sp-3) 3px var(--sp-2);
+ padding: 3px var(--sp-2) 3px var(--sp-2);
font-size: var(--fs-12);
color: var(--ink);
}
@@ -682,6 +654,27 @@ textarea {
box-shadow: 0 0 5px var(--live-glow);
}
+/* Green session count baked into each host chip (replaces the global tally). */
+.daemon-count {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 17px;
+ height: 17px;
+ padding: 0 5px;
+ border-radius: var(--r-pill);
+ font-size: var(--fs-11);
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ color: var(--live);
+ background: color-mix(in srgb, var(--live) 16%, transparent);
+}
+
+.daemon-count.is-empty {
+ color: var(--muted);
+ background: var(--surface-2);
+}
+
.daemon-empty {
display: inline-flex;
align-items: center;
@@ -753,6 +746,7 @@ textarea {
.folder-name {
flex: 1 1 auto;
+ min-width: 0;
color: var(--ink);
font-size: var(--fs-14);
font-weight: 500;
@@ -761,6 +755,12 @@ textarea {
white-space: nowrap;
}
+/* Earlier path segments collapse to their initial; the trailing segment (the
+ one that actually names the dir) stays full. Dim the collapsed prefix. */
+.folder-name .folder-stem {
+ color: var(--faint);
+}
+
.folder-count {
font-size: var(--fs-11);
color: var(--muted);