Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(sidebar,tabbar): more name, and the SSH chip stays on the tab

enes6572c5e27ba5
diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsx
index e7162dd58..10ef19386 100644
--- a/src/renderer/components/SessionRow.tsx
+++ b/src/renderer/components/SessionRow.tsx
@@ -170,24 +170,30 @@ export function SessionRow({
{contextPillText(usage.usedTokens, usage.windowTokens, usage.usedPercent, percentMode)}
</span>
)}
- <button
- className="ss-row__ai"
- title="Name with AI (from terminal output)"
- disabled={naming}
- onClick={aiName}
- >
- {naming ? '…' : '✦'}
- </button>
- <button
- className="ss-row__close"
- title="End session"
- onClick={(e) => {
- e.stopPropagation()
- onClose()
- }}
- >
- <IconClose />
- </button>
+ {/* Both buttons are invisible until the row is hovered, yet they used to hold 46px of a
+ 253px line — a quarter of it — away from the NAME. The cluster is taken out of flow
+ and floated over the line's tail on hover instead: the tail is what an ellipsis was
+ already eating, and the name gets those pixels back at every other moment. */}
+ <span className="ss-row__actions">
+ <button
+ className="ss-row__ai"
+ title="Name with AI (from terminal output)"
+ disabled={naming}
+ onClick={aiName}
+ >
+ {naming ? '…' : '✦'}
+ </button>
+ <button
+ className="ss-row__close"
+ title="End session"
+ onClick={(e) => {
+ e.stopPropagation()
+ onClose()
+ }}
+ >
+ <IconClose />
+ </button>
+ </span>
</div>
{(row.projectName || row.cwd || row.sshHost || stateAgeLabel) && (
<div className="ss-meta">
diff --git a/src/renderer/lib/tabDensity.test.ts b/src/renderer/lib/tabDensity.test.ts
index 9367d3b57..b1b88f07c 100644
--- a/src/renderer/lib/tabDensity.test.ts
+++ b/src/renderer/lib/tabDensity.test.ts
@@ -1,4 +1,6 @@
import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
import {
COMPACT_MIN_TAB_PX,
ROOMY_MIN_TAB_PX,
@@ -27,19 +29,33 @@ describe('tabDensity', () => {
expect(tabDensity(168 * 4, 4)).toBe('roomy')
})
- it('drops the SSH chip first: the field report at 8 tabs in 1340px is compact, not tight', () => {
- // 1098 / 8 = 137px per tab — enough for caret + 60px of name, not for the chip as well.
+ it('defers the CARET first, so the field report at 8 tabs in 1340px KEEPS its SSH chips', () => {
+ // 1098 / 8 = 137px per tab — enough for the chip + 60px of name, not for the caret as well.
+ // Reported from the running app after the first version shed the chip here instead: the `SSH`
+ // label went missing from every remote tab at the width people actually work at.
expect(tabDensity(STRIP_1340_MAC, 8)).toBe('compact')
- expect(tabDensity(ROOMY_MIN_TAB_PX * 8 - 8, 8)).toBe('compact')
+ expect(COMPACT_MIN_TAB_PX).toBe(TAB_BASE_FURNITURE_PX + TAB_SSH_CHIP_PX + TAB_NAME_MIN_PX)
+ expect(STRIP_1340_MAC / 8).toBeGreaterThanOrEqual(COMPACT_MIN_TAB_PX)
})
- it('hides the inactive caret only when the caret itself would squeeze the name', () => {
- // 1098 / 12 = 91.5px per tab: below the caret floor, above the bare floor.
+ it('hides the SSH chip only when the chip itself would squeeze the name', () => {
+ // 1098 / 12 = 91.5px per tab: below the chip floor, above the bare floor.
expect(tabDensity(STRIP_1340_MAC, 12)).toBe('tight')
expect(tabDensity(COMPACT_MIN_TAB_PX * 12 - 12, 12)).toBe('tight')
expect(tabDensity(COMPACT_MIN_TAB_PX * 12, 12)).toBe('compact')
})
+ it('the caret is deferred, never removed — it returns on hover at every level', () => {
+ // A pin on the CSS, because the whole trade rests on it: the caret is one hover away, the
+ // chip (at `tight`) is not on the tab at all. Both selectors must keep the hover escape.
+ const css = readFileSync(join(__dirname, '../styles.css'), 'utf8').replace(/\r\n/g, '\n')
+ for (const level of ['compact', 'tight']) {
+ expect(css).toContain(
+ `.tabbar__tabs[data-density='${level}'] .tab:not(.active):not(:hover):not(.tab--menu-open) .tab__actions`
+ )
+ }
+ })
+
it('never lets the name floor fall below the width of a short word', () => {
// Below this the fade zone (18px) eats most of what is left; 24px was the reported bug.
expect(TAB_NAME_MIN_PX).toBeGreaterThanOrEqual(56)
diff --git a/src/renderer/lib/tabDensity.ts b/src/renderer/lib/tabDensity.ts
index b298f21d5..24a825f9f 100644
--- a/src/renderer/lib/tabDensity.ts
+++ b/src/renderer/lib/tabDensity.ts
@@ -15,9 +15,16 @@
*
* Three levels, each dropping one thing, cheapest first:
* roomy — everything shown.
- * compact — the SSH chip is hidden (the tab's tooltip still carries user@host).
- * tight — the options caret on INACTIVE tabs shows only on hover (and while its menu is open);
+ * compact — the options caret on INACTIVE tabs shows only on hover (and while its menu is open);
* the active tab keeps both its buttons at every width.
+ * tight — the SSH chip is hidden too (the tab's tooltip still carries user@host).
+ *
+ * The CARET goes before the CHIP, which is the opposite of the first version of this file and was
+ * a field correction: at 8 tabs / 1340px the strip lands on the middle level, so shedding the chip
+ * there took the `SSH` label off every remote tab in the common case. The chip is IDENTITY — which
+ * of two same-named projects is the one on the server — while the caret is an ACTION that is one
+ * hover away at every level (and a hover is how Chrome treats its own close button at this width).
+ * Losing a label you read costs more than deferring a control you click.
*
* One rule for the whole strip rather than per tab, so neighbours never disagree about which
* furniture is on show. The thresholds are derived from the measured furniture, not chosen.
@@ -36,8 +43,8 @@ export type TabDensity = 'roomy' | 'compact' | 'tight'
/** A tab can show everything (chip and caret) and still keep a readable name at this width. */
export const ROOMY_MIN_TAB_PX = TAB_BASE_FURNITURE_PX + TAB_SSH_CHIP_PX + TAB_CARET_PX + TAB_NAME_MIN_PX
-/** A tab can show the caret (no chip) and keep a readable name at this width. */
-export const COMPACT_MIN_TAB_PX = TAB_BASE_FURNITURE_PX + TAB_CARET_PX + TAB_NAME_MIN_PX
+/** A tab can show the CHIP (caret on hover) and keep a readable name at this width. */
+export const COMPACT_MIN_TAB_PX = TAB_BASE_FURNITURE_PX + TAB_SSH_CHIP_PX + TAB_NAME_MIN_PX
/**
* @param stripInnerWidth the strip's width minus its own padding, in CSS px; `null`/non-finite
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 1b75e5e21..59cc828b3 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -575,23 +575,27 @@ body,
/* Density: which furniture a tab sheds so the NAME survives, decided per strip by TabBar
(`lib/tabDensity.ts`, from the strip's measured width and the tab count) and stamped as
- `data-density`. Cheapest first — the chip, then the inactive caret — and the active tab keeps
- both its buttons at every level: the board toggle belongs to the tab you are looking at. */
-.tabbar__tabs[data-density='compact'] .tab__ssh,
-.tabbar__tabs[data-density='tight'] .tab__ssh {
- display: none;
-}
+ `data-density`. Cheapest first — the inactive caret, then the chip — and the active tab keeps
+ both its buttons at every level: the board toggle belongs to the tab you are looking at.
-/* Tight: an inactive tab's caret is there on hover (Chrome's close button does the same at this
- width) and stays while its menu is open — the pointer is on the menu then, not the tab, and a
- caret that vanished under an open menu would read as the menu having come from nowhere. It is
+ An inactive tab's caret is there on hover (Chrome's close button does the same at this width)
+ and stays while its menu is open — the pointer is on the menu then, not the tab, and a caret
+ that vanished under an open menu would read as the menu having come from nowhere. It is
`display: none`, not `visibility`, so the freed width goes to the name — and it is the whole
actions CLUSTER that goes, not the caret inside it: on an inactive tab the cluster holds only
the caret, and an emptied cluster still costs its margin and the tab's gap (8px measured). */
+.tabbar__tabs[data-density='compact'] .tab:not(.active):not(:hover):not(.tab--menu-open) .tab__actions,
.tabbar__tabs[data-density='tight'] .tab:not(.active):not(:hover):not(.tab--menu-open) .tab__actions {
display: none;
}
+/* Tight only: the SSH chip goes as well. It is shed LAST because it is identity rather than an
+ action — which of two same-named projects is the one on the server — and the tab's tooltip is
+ the only other place that says so. */
+.tabbar__tabs[data-density='tight'] .tab__ssh {
+ display: none;
+}
+
/* A shorter fade on a tight strip: 18px of a 60px name is a third of it under the gradient. */
.tabbar__tabs[data-density='tight'] .tab__name {
--tab-fade: 12px;
@@ -7916,13 +7920,15 @@ button.group-node__setup:disabled {
align-items: center;
gap: 6px;
min-width: 0;
+ /* The actions cluster is absolutely positioned inside this line (see `.ss-row__actions`). */
+ position: relative;
/* The title's floor. The sidebar is 300px wide and the row already carries a status dot, a
monogram, a session chip, a context pill and two buttons, so the NAME is the only thing that
can absorb another chip — and it did: with the account chip present the title measured 45px
(4-5 characters) against 128px without it. Everything else in the line yields before the name
does. ~10 characters at 12.5px, which is what makes two similarly-named sessions
distinguishable. */
- --ss-title-min: 96px;
+ --ss-title-min: 120px;
}
.ss-mark { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.ss-title { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: var(--ss-title-min); }
@@ -7939,7 +7945,35 @@ button.group-node__setup:disabled {
.ss-meta__ssh { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.ss-meta__state-age { margin-left: auto; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.ss-ctx { font-size: 9.5px; padding: 0 5px; border-radius: 4px; color: #000; font-weight: 600; flex: 0 0 auto; }
-.ss-row__ai { margin-left: auto; opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px; flex: 0 0 auto; }
+/* Out of FLOW, not merely invisible. Both buttons already appeared only on hover, yet they held
+ 46px of a 253px line — measured — away from the name at every other moment. Floated over the
+ line's tail instead: that tail is what the ellipsis was eating anyway, and the fade in front of
+ them keeps the text from running into the glyphs. `pointer-events` follows the opacity so a
+ hidden cluster cannot swallow a click meant for the row. */
+.ss-row__actions {
+ position: absolute;
+ right: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding-left: 14px;
+ opacity: 0;
+ pointer-events: none;
+ background: linear-gradient(90deg, transparent, var(--panel-header) 14px);
+}
+.ss-row:hover .ss-row__actions,
+.ss-row__actions:focus-within {
+ opacity: 1;
+ pointer-events: auto;
+}
+/* The active row paints its own tint, so the fade must end in THAT colour or the cluster sits on a
+ visible patch of the wrong grey. */
+.ss-row.is-active .ss-row__actions {
+ background: linear-gradient(90deg, transparent, var(--panel-header) 14px);
+}
+.ss-row__ai { opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px; flex: 0 0 auto; }
.ss-row:hover .ss-row__ai { opacity: 0.6; }
.ss-row__ai:hover { opacity: 1 !important; color: var(--accent); }
.ss-row__ai:disabled { opacity: 0.6; cursor: default; color: var(--accent); }
diff --git a/src/renderer/styles.sidebar-row.test.ts b/src/renderer/styles.sidebar-row.test.ts
index 8c144f69e..a3aaf79cf 100644
--- a/src/renderer/styles.sidebar-row.test.ts
+++ b/src/renderer/styles.sidebar-row.test.ts
@@ -62,6 +62,19 @@ describe('sessions-sidebar row: the name outranks the chips', () => {
expect(ROW).toContain('<AccountChip chip={accountChip} className="ss-account" />')
})
+ it('takes the hover-only actions OUT of flow, so they cost the name nothing', () => {
+ // Measured: both buttons are invisible until the row is hovered, and in flow they held 46px of
+ // a 253px line. Out of flow the same row's name went 101px -> 131px (and 136 -> 174 with one
+ // chip). `position: absolute` is the whole mechanism; the pointer-events pair is what stops an
+ // invisible cluster from swallowing clicks meant for the row.
+ const r = rule('.ss-row__actions')
+ expect(r).toContain('position: absolute')
+ expect(r).toContain('pointer-events: none')
+ expect(CSS).toMatch(/\.ss-row:hover \.ss-row__actions[^{]*\{[^}]*pointer-events: auto/)
+ // The line it floats inside must establish the containing block, or it anchors to the viewport.
+ expect(rule('.ss-row__titleline')).toContain('position: relative')
+ })
+
it('keeps the session chip readable once truncated, via its tooltip', () => {
// It can now be ellipsised, and an ellipsised chip with no tooltip is the one state where the
// session name is unrecoverable from the UI.
diff --git a/src/renderer/styles.tabbar.test.ts b/src/renderer/styles.tabbar.test.ts
index d9ea2589d..57d9ac4b8 100644
--- a/src/renderer/styles.tabbar.test.ts
+++ b/src/renderer/styles.tabbar.test.ts
@@ -95,10 +95,16 @@ describe('tab strip geometry', () => {
})
it('sheds furniture by density before the name is squeezed, and never the active tab\'s buttons', () => {
- const compactChip = CSS.match(/\.tabbar__tabs\[data-density='compact'\] \.tab__ssh,\s*\.tabbar__tabs\[data-density='tight'\] \.tab__ssh \{[^}]*display:\s*none/)
- expect(compactChip).not.toBeNull()
- const tightCaret = CSS.match(/\.tabbar__tabs\[data-density='tight'\] \.tab:not\(\.active\):not\(:hover\):not\(\.tab--menu-open\) \.tab__actions \{[^}]*display:\s*none/)
- expect(tightCaret).not.toBeNull()
+ // ORDER: the caret is deferred to hover at `compact`, and only `tight` takes the SSH chip off
+ // the tab. Reported from the running app — the first version shed the chip at `compact`, which
+ // is the level 8 tabs in a 1340px window land on, so every remote tab lost its `SSH` label at
+ // the width people work at. A deferred control is cheaper than a label that is simply gone.
+ const compactCaret = CSS.match(/\.tabbar__tabs\[data-density='compact'\] \.tab:not\(\.active\):not\(:hover\):not\(\.tab--menu-open\) \.tab__actions,\s*\.tabbar__tabs\[data-density='tight'\] \.tab:not\(\.active\):not\(:hover\):not\(\.tab--menu-open\) \.tab__actions \{[^}]*display:\s*none/)
+ expect(compactCaret).not.toBeNull()
+ const tightChip = CSS.match(/\.tabbar__tabs\[data-density='tight'\] \.tab__ssh \{[^}]*display:\s*none/)
+ expect(tightChip).not.toBeNull()
+ // The chip is never hidden at `compact` — the regression this replaced.
+ expect(CSS).not.toMatch(/\.tabbar__tabs\[data-density='compact'\] \.tab__ssh[^{]*\{[^}]*display:\s*none/)
// Nothing hides the board toggle at any density.
expect(CSS).not.toMatch(/\[data-density[^\]]*\][^{]*\.tab__board-toggle[^{]*\{[^}]*display:\s*none/)
})