fix: treat legacy tray icons like other items

The AppIndicator extension also adds legacy (XEmbed) tray icons, with
roles like "appindicator-legacy:<wm_class>:<pid>". They have no
`_indicator`, so `#handleAppIndicatorItem()` threw
"TypeError: appIndicator is undefined". As this runs inside the
overwritten `Panel._addToPanelBox`, the error broke whichever extension
was adding a top-bar item at the time, or Top Bar Organizer's own
`enable()`.

Only take the AppIndicator path when there is an `_indicator`.

Patch by yuri in #31.

Fixes #31
This commit is contained in:
Michał T 2026-11-09 10:09:51 +01:00
commit 316be3851f

View file

@ -338,10 +338,14 @@ export default class BoxOrderManager extends GObject.Object {
// Then get a settings identifier for the item.
let itemSettingsId;
if (role.startsWith("appindicator-")) {
if (role.startsWith("appindicator-") &&
(indicatorContainer.get_child() as any)?._indicator) {
// If the role indicates that the item is an
// AppIndicator/KStatusNotifierItem item, then handle it
// differently.
// Legacy (XEmbed) tray icons added by the same extension
// also get an "appindicator-" role, but have no
// _indicator, so they're treated like any other item.
try {
itemSettingsId = this.#handleAppIndicatorItem(indicatorContainer, role);
} catch (e) {