Drop colour from the panel, and the message that said nothing

Two changes that turned out to be related.

The chips painted their own red, amber and green. An indicator that picks
its own colours competes with the shell's accents and stops following the
theme, so the panel now draws everything in the panel's text colour and
lets shape carry the state. Only alpha still varies, to push idle sessions
back.

That put real weight on the four shapes being distinguishable at 14 px,
which is not something to guess at, so the drawing moved to lib/glyph.js
-- free of St, Clutter and shell imports precisely so the glyphs can be
rendered to a file and looked at. They were, and the first attempt was
wrong twice: a disc filled to the ring's centreline reads smaller than the
ring beside it, and the inner disc of "blocked" was too small to tell from
a plain "working" ring. Radii are now matched at the outer edge and the
inner disc sits at 0.55, both settled by comparing renders.

Separately, hooking a live session showed the Notification that accompanies
a permission prompt carries only "Claude needs your permission" -- no tool,
no command -- and arrives identically when the session is putting a question
to the user rather than asking to run something. The menu was giving that
string the line, pushing out the tab and the path: strictly less information
in more space. It is gone, and the comment claiming it "says what is about
to run" is corrected. Recovering the real command means reading the tail of
the transcript when the prompt fires; it is not in the event.

The same finding settles how far the states can split. "Blocked" cannot be
divided into "asking permission" and "asking a question" from this data.
This commit is contained in:
av
2026-08-09 19:02:43 +03:00
parent a4e5d653de
commit 839c6f6b52
5 changed files with 109 additions and 73 deletions
+28 -52
View File
@@ -14,6 +14,7 @@ import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.j
import { SessionStore, STATES } from './sessions.js';
import { ZellijTabs } from './zellij.js';
import { assignChips } from './abbrev.js';
import { drawState } from './glyph.js';
import { formatAge, projectName, shortenHome } from './format.js';
// Translated lazily: gettext is not bound yet while modules are being imported.
@@ -32,50 +33,21 @@ const TERMINAL_CLASSES = [
'foot', 'wezterm', 'konsole', 'xterm', 'ghostty',
];
/** Paint the state glyph in the actor's inherited foreground colour, so the
* stylesheet decides the colour and this stays theme-agnostic. */
/** Paint a state glyph in the panel's own text colour.
*
* Nothing here picks a colour: the foreground comes from the theme node, so
* the row follows the panel through light, dark and custom themes. The shapes
* live in glyph.js, which imports nothing and can therefore be rendered to a
* file and inspected.
*/
function drawStateDot(area, state) {
const cr = area.get_context();
try {
const [w, h] = area.get_surface_size();
const color = area.get_theme_node().get_foreground_color();
const r = color.red / 255;
const g = color.green / 255;
const b = color.blue / 255;
const a = color.alpha / 255;
const cx = w / 2;
const cy = h / 2;
const radius = Math.min(w, h) / 2 - 1.5;
cr.setLineWidth(1.5);
cr.setSourceRGBA(r, g, b, a);
switch (state) {
case 'blocked':
// Disc inside a ring: the loudest shape, for the only state where
// a session is stuck until you act.
cr.arc(cx, cy, radius, 0, 2 * Math.PI);
cr.stroke();
cr.arc(cx, cy, radius * 0.5, 0, 2 * Math.PI);
cr.fill();
break;
case 'waiting':
cr.arc(cx, cy, radius, 0, 2 * Math.PI);
cr.fill();
break;
case 'busy':
cr.arc(cx, cy, radius, 0, 2 * Math.PI);
cr.stroke();
break;
default:
cr.setDash([2, 2], 0);
cr.setSourceRGBA(r, g, b, a * 0.5);
cr.arc(cx, cy, radius, 0, 2 * Math.PI);
cr.stroke();
cr.setDash([], 0);
break;
}
const c = area.get_theme_node().get_foreground_color();
drawState(cr, state, w, h, {
r: c.red / 255, g: c.green / 255, b: c.blue / 255, a: c.alpha / 255,
});
} finally {
cr.$dispose();
}
@@ -120,18 +92,19 @@ class ClaudeStatusIndicator extends PanelMenu.Button {
y_align: Clutter.ActorAlign.CENTER,
});
// Shape carries the state as well as colour does, so the row still
// reads under a monochrome theme or with colour vision deficiency:
// filled disc in a ring — blocked on a permission prompt;
// filled disc — turn finished, waiting for input;
// bright ring — working;
// dim dashed ring — idle.
// The panel is monochrome, so shape alone carries the state:
// disc inside a ring — blocked on a permission prompt;
// filled disc — turn finished, waiting for input;
// ring — working;
// dashed, dimmed — idle.
// Colour is left to the shell's own accents; an indicator that paints
// its own red competes with them and stops matching the theme.
const dot = new St.DrawingArea({
style_class: 'ccs-dot',
y_align: Clutter.ActorAlign.CENTER,
});
dot.set_width(12);
dot.set_height(12);
dot.set_width(14);
dot.set_height(14);
dot.connect('repaint', area => drawStateDot(area, session.state));
chip.add_child(dot);
@@ -342,10 +315,13 @@ class ClaudeStatusIndicator extends PanelMenu.Button {
where.push(`${_('zellij')}: ${session.zellijSession}`);
where.push(shortenHome(session.cwd));
// A permission prompt is the one case where the reason matters more
// than the location: it says what is about to run.
if (session.state === 'blocked' && session.message)
return `${session.message}${where.join(' · ')}`;
// The message that comes with a permission prompt is generic --
// observed verbatim as "Claude needs your permission", with no tool
// name and no command, and identical whether the session is asking to
// run something or putting a question to you. Showing it would push
// the tab and the path out of the line to say less than the state
// label already does. Getting the real command means reading the tail
// of the transcript when the prompt fires; it is not in the event.
return `${stateLabel(session.state)} · ${where.join(' · ')}`;
}