Make the panel position and the label width settings
Two things that were constants and had no business being constants. Placement: the box (left, centre, right) and the index within it. The default is unchanged -- centre, index 1, immediately right of the clock -- and an index past the end of a box lands at the end, so a large one means "last". Applied at once, no reload. Moving is done by rebuilding the indicator rather than by moving the actor. addToStatusArea is what registers it under the uuid and there is no documented call to move one between boxes; everything else reaches into Main.panel's private boxes. It costs one re-read of a few small state files and only when the setting is touched. Label width: three characters by default, settable up to ten, not down. Three is enough to keep initials apart and narrow enough not to shove the clock about; below three, distinct projects start sharing a label. A wider label takes more initials rather than a longer prefix -- a prefix collapses dev-skills and dev-conventions at any width -- so dev-skills stays "ds" however wide the setting, while claude-code-gnome-extension becomes "ccge" at four. A disambiguating digit still eats into the label instead of extending past the width, so a chip that gains one does not push the row. Sticky labels work against that setting: kept labels are kept whatever width they were cut at, so widening would leave every session on screen at its old width until it ended. The width is therefore the one thing that discards the map -- a relabelling that was asked for is not a label moving under your hand. The combo row is bound by hand: Gio.Settings.bind maps a boolean to 'active' and an int to 'value', but a string to a selected index needs bind_with_mapping, which is not introspectable. Only the write direction is wired up, and the test covers it, because a row that stores its index instead of its value looks fine until the shell reads the key. Fixed on the way, found by watching the centre box grow 2 -> 3 -> 4 -> 5 across four moves: PanelMenu.ButtonBox connects `this._onDestroy.bind(this)` in its _init, and its _onDestroy is what destroys the container -- the St.Bin the panel box actually holds. The name resolves through the prototype chain, so this extension's own _onDestroy had been silently replacing the shell's since the beginning, leaving an empty container in the panel on every teardown. Renamed to _teardown; the box now stays at two children across moves and across enable/disable cycles. Verified in a nested shell on a copy of the extension carrying temporary logging, since the shell refuses screenshots to non-portal callers: every box, indices 0, 1 and 9, and widths 3, 5, 8, 10 and back, with no JS errors and no leftover actors.
This commit is contained in:
@@ -42,19 +42,43 @@ Code ждёт меня прямо сейчас?**
|
||||
текстом `«Claude needs your permission»`. Различить их можно было бы только через
|
||||
`PreToolUse` — ценой записи файла на каждый вызов инструмента.
|
||||
|
||||
Чипов показывается три (настраивается), остальные сворачиваются в `+N`. Панель
|
||||
живёт в центральном боксе рядом с часами, и без предела достаточно открытых
|
||||
сессий сдвинули бы часы с центра.
|
||||
Чипов показывается три (настраивается), остальные сворачиваются в `+N`. По
|
||||
умолчанию ряд живёт в центральном боксе сразу справа от часов, и без предела
|
||||
достаточно открытых сессий сдвинули бы часы с центра.
|
||||
|
||||
Чипы идут по срочности, а внутри одного состояния первой стоит **самая
|
||||
давняя**: забывается та, что ждёт дольше всех, а не последняя. Время в
|
||||
состоянии показывается только у первого чипа: пять счётчиков рядом — это
|
||||
ряд чисел, а не ответ на вопрос.
|
||||
|
||||
## Место в панели
|
||||
|
||||
Бокс (левый, центральный, правый) и позиция внутри бокса задаются в настройках и
|
||||
применяются сразу, без релогина. Индекс 0 — первым в боксе; в центральном 1 —
|
||||
сразу справа от часов, единственного его обитателя по умолчанию. Индекс больше
|
||||
числа элементов кладёт ряд в конец, так что «10» — это способ сказать «последним».
|
||||
|
||||
Перестановка **пересоздаёт** индикатор, а не двигает актор: `addToStatusArea` —
|
||||
это и есть регистрация под uuid, а публичного вызова «перенести в другой бокс» в
|
||||
shell нет; всё остальное лезет в приватные боксы `Main.panel`. Стоит это одного
|
||||
перечитывания нескольких маленьких файлов состояния, и только когда настройку
|
||||
трогают.
|
||||
|
||||
Здесь же вскрылась давняя утечка. `PanelMenu.ButtonBox` в своём `_init` делает
|
||||
`this.connect('destroy', this._onDestroy.bind(this))`, а его `_onDestroy`
|
||||
уничтожает `container` — тот самый `St.Bin`, который лежит в боксе панели.
|
||||
Имя разрешается по цепочке прототипов, поэтому наш метод с тем же именем **молча
|
||||
подменял** шелловский, и контейнер оставался в панели после каждого выключения
|
||||
расширения. Наш обработчик теперь называется `_teardown`. Измерено: до
|
||||
переименования центральный бокс рос на один пустой актор с каждой перестановкой
|
||||
(2 → 3 → 4 → 5), после — стабильно 2.
|
||||
|
||||
## Метки чипов
|
||||
|
||||
Имя проекта сжимается до трёх знаков: если в имени несколько сегментов
|
||||
(`-`, `_`, camelCase) — инициалы, иначе первые буквы.
|
||||
Имя проекта сжимается до трёх знаков — в настройках можно больше, но не меньше:
|
||||
три хватает, чтобы развести инициалы, и достаточно узко, чтобы ряд не толкал
|
||||
часы. Если в имени несколько сегментов (`-`, `_`, camelCase) — инициалы, иначе
|
||||
первые буквы.
|
||||
|
||||
| Проект | Чип |
|
||||
|---|---|
|
||||
@@ -80,6 +104,14 @@ Code ждёт меня прямо сейчас?**
|
||||
закрылась сессия, из-за которой появилась цифра. Метка, переехавшая под
|
||||
рукой, хуже метки с цифрой, которая уже не выглядит нужной.
|
||||
|
||||
Более широкая метка берёт **больше инициалов**, а не более длинный префикс — по
|
||||
той же причине. Поэтому `dev-skills` останется `ds` при любой ширине, а
|
||||
`claude-code-gnome-extension` при четырёх знаках станет `ccge`.
|
||||
|
||||
Ширина — единственное, что сбрасывает закреплённые метки: перерисовка, о которой
|
||||
попросили сами, это не метка, уехавшая под рукой. Смена ширины перелейблит все
|
||||
сессии разом.
|
||||
|
||||
Сокращение отключается в настройках — тогда в чипах полные имена проектов.
|
||||
В меню строка начинается с той же метки, чтобы соответствие «`ds` — это
|
||||
dev-skills» читалось, а не угадывалось.
|
||||
|
||||
Reference in New Issue
Block a user