Cap the chips at three, and make the menu report-only
Two changes that pull in the same direction: the panel says less, and the menu stops pretending to do anything. The chip row had no bound. It sits in the centre box next to the clock, so enough open sessions would have shoved the clock off centre. It now shows the first N, settable and three by default, and counts the rest as "+N". Chips are already ordered by urgency, so the ones that survive the cut are the ones that need you soonest. Labels are still assigned across every session, including hidden ones, so a chip does not change when the cap does or when a session ahead of it disappears. Clicking a menu row used to switch the zellij tab and raise a terminal. That is gone. It cost real machinery for what it saved -- gnome-terminal runs every window under one shared server process, so windows cannot be matched by pid and the code fell back to matching the zellij session name against window titles, with all the ways that misses. The menu reports status; alt-tab is not the bottleneck. Rows are built inert rather than demoted after the fact, because PopupBaseMenuItem latches _activatable in its constructor. zellij tab lookup stays: naming the tab is the better half of that feature and costs one process every couple of minutes. The preferences test now asserts a control per settings key rather than a switch per key, so the new spin row counts and a future non-boolean setting cannot slip in without one.
This commit is contained in:
@@ -24,6 +24,10 @@ export default class ClaudeCodeStatusPreferences extends ExtensionPreferences {
|
||||
dispGroup.add(this._switchRow(settings, 'abbreviate-names',
|
||||
_('Shorten names to three characters'),
|
||||
_('“dev-skills” becomes “ds”. Collisions get a digit by seniority, so a label already on screen never changes.')));
|
||||
dispGroup.add(this._spinRow(settings, 'max-chips',
|
||||
_('Chips shown'),
|
||||
_('The most urgent sessions get a chip; the rest are counted as “+N”.'),
|
||||
1, 12));
|
||||
dispGroup.add(this._switchRow(settings, 'show-age',
|
||||
_('Show time in state'),
|
||||
_('Shown on the most urgent session only.')));
|
||||
@@ -36,7 +40,7 @@ export default class ClaudeCodeStatusPreferences extends ExtensionPreferences {
|
||||
|
||||
zellijGroup.add(this._switchRow(settings, 'zellij-integration',
|
||||
_('Resolve tab names'),
|
||||
_('Show the zellij tab in the menu and switch to it on click. Ignored when zellij is not installed.')));
|
||||
_('Name the zellij tab each session runs in. Ignored when zellij is not installed.')));
|
||||
|
||||
// --- Hooks ---------------------------------------------------------
|
||||
// The indicator is only as good as the hooks feeding it, and a silent
|
||||
@@ -98,6 +102,17 @@ export default class ClaudeCodeStatusPreferences extends ExtensionPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
_spinRow(settings, key, title, subtitle, lower, upper) {
|
||||
const row = new Adw.SpinRow({
|
||||
title, subtitle,
|
||||
adjustment: new Gtk.Adjustment({
|
||||
lower, upper, step_increment: 1, page_increment: 1,
|
||||
}),
|
||||
});
|
||||
settings.bind(key, row, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
return row;
|
||||
}
|
||||
|
||||
_switchRow(settings, key, title, subtitle) {
|
||||
const row = new Adw.SwitchRow({ title, subtitle });
|
||||
settings.bind(key, row, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
Reference in New Issue
Block a user