Put the clock on the working chips, and on all of them
The counter rode on the first chip, whichever state it happened to be in. It now shows on every chip that is working and on no other: how long a session has been at it is the thing that decides whether to wait for it, where the age of an idle one only says how long ago you stopped looking. The setting keeps its key and changes its name to "Show working time". CLAUDE.md is new, and its first rule is the one broken twice: writing to dconf from a shell attached to the live session bus wipes settings that cannot be recovered.
This commit is contained in:
+23
-16
@@ -61,6 +61,7 @@ class ClaudeStatusIndicator extends PanelMenu.Button {
|
||||
this._store = new SessionStore();
|
||||
this._zellij = new ZellijTabs();
|
||||
this._chipLabels = new Map();
|
||||
this._ageLabels = new Map();
|
||||
this._rows = [];
|
||||
|
||||
this._buildPanel();
|
||||
@@ -222,21 +223,24 @@ class ClaudeStatusIndicator extends PanelMenu.Button {
|
||||
const shown = sessions.slice(0, maxChips);
|
||||
const hidden = sessions.length - shown.length;
|
||||
|
||||
// Age rides on the first chip only. Sessions are sorted by urgency, so
|
||||
// that is the one whose age decides anything; five ages side by side
|
||||
// would just be a wide row of numbers.
|
||||
const ageOnFirst = showAge && shown.length > 0;
|
||||
// Age rides on the working chips, and on all of them. A session that
|
||||
// is working is the one you might be waiting on, and how long it has
|
||||
// been at it is the whole question -- five minutes is a build, forty
|
||||
// is a session stuck on something. The states where nothing is
|
||||
// happening have no such clock: their age says how long ago you
|
||||
// stopped looking, which the row's own presence already says.
|
||||
const ageOn = session => showAge && session.state === 'busy';
|
||||
const signature = shown
|
||||
.map(s => `${s.sessionId}:${s.state}:${labelFor(s)}`)
|
||||
.join('|') + `|${ageOnFirst}|${hidden}`;
|
||||
.join('|') + `|${showAge}|${hidden}`;
|
||||
if (signature !== this._chipSignature) {
|
||||
this._chipBox.destroy_all_children();
|
||||
this._ageLabel = null;
|
||||
shown.forEach((session, i) => {
|
||||
this._ageLabels = new Map();
|
||||
shown.forEach(session => {
|
||||
const { chip, age } = this._buildChip(
|
||||
session, labelFor(session), ageOnFirst && i === 0);
|
||||
session, labelFor(session), ageOn(session));
|
||||
if (age)
|
||||
this._ageLabel = { age, sessionId: session.sessionId };
|
||||
this._ageLabels.set(session.sessionId, age);
|
||||
this._chipBox.add_child(chip);
|
||||
});
|
||||
if (hidden > 0) {
|
||||
@@ -249,13 +253,16 @@ class ClaudeStatusIndicator extends PanelMenu.Button {
|
||||
this._chipSignature = signature;
|
||||
}
|
||||
|
||||
if (this._ageLabel) {
|
||||
// Looked up again rather than captured: a session that returns to
|
||||
// the same state within one refresh keeps the signature unchanged,
|
||||
// and a captured object would then show an age that stopped moving.
|
||||
const current = sessions.find(s => s.sessionId === this._ageLabel.sessionId);
|
||||
if (current)
|
||||
this._ageLabel.age.text = formatAge(this._ageOf(current));
|
||||
// Looked up again rather than captured: a session that returns to the
|
||||
// same state within one refresh keeps the signature unchanged, and a
|
||||
// captured object would then show an age that stopped moving.
|
||||
if (this._ageLabels.size) {
|
||||
const byId = new Map(sessions.map(s => [s.sessionId, s]));
|
||||
for (const [sessionId, label] of this._ageLabels) {
|
||||
const current = byId.get(sessionId);
|
||||
if (current)
|
||||
label.text = formatAge(this._ageOf(current));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user