Skip to content

sni/watcher: accept combined "bus_name/object_path" item registrations (Electron 43.4.1+) - #5287

Open
teivng wants to merge 1 commit into
Alexays:masterfrom
teivng:sni-watcher-combined-registration
Open

sni/watcher: accept combined "bus_name/object_path" item registrations (Electron 43.4.1+)#5287
teivng wants to merge 1 commit into
Alexays:masterfrom
teivng:sni-watcher-combined-registration

Conversation

@teivng

@teivng teivng commented Aug 31, 2026

Copy link
Copy Markdown

Fixes #5240.

Problem

Electron ≥ 43.4.1 (Chromium 150.0.7871.224) changed how its tray icon registers with the StatusNotifierWatcher: instead of a bare object path it now sends a combined bus_name/object_path string. Captured on the bus (busctl --user monitor org.kde.StatusNotifierWatcher), Signal-Desktop 8.25.0:

Member=RegisterStatusNotifierItem
  STRING "org.freedesktop.StatusNotifierItem-36777-1/StatusNotifierItem/1";

Watcher::handleRegisterItem only understands two shapes — a string starting with / (object path, resolved against the sender) or a plain bus name — so it runs g_dbus_is_name() on the whole combined string and rejects it:

ErrorName=org.freedesktop.DBus.Error.InvalidArgs
ErrorMessage="D-Bus bus name 'org.freedesktop.StatusNotifierItem-36777-1/StatusNotifierItem/1' is not valid"

On rejection Electron releases its bus name and destroys the tray icon permanently (it does not retry, not even when the watcher restarts), so the app shows no tray icon for the rest of its lifetime. Side-by-side comparison of the same app across the Electron bump:

Signal 8.23.0 (Electron 43.0.0) Signal 8.25.0 (Electron 43.4.1)
Registers as /org/chromium/StatusNotifierItem/1 org.freedesktop.StatusNotifierItem-36777-1/StatusNotifierItem/1
Result accepted rejected → icon torn down

Slack (Electron 43.4.0) still registers with a bare bus name and works, so this will progressively hit every Electron app as they update past 43.4.1. KDE's StatusNotifierWatcher accepts the combined form.

Fix

When the service string contains a / but does not start with one, split at the first / into bus name and object path. The two existing forms are handled exactly as before. As a bonus, g_bus_watch_name() now watches the actual bus name for these items, so they are pruned correctly when the owner exits.

Testing

Running this patch on waybar 0.15.0 under Hyprland: Signal 8.25.0's icon registers, appears in the tray, and survives repeated window close/reopen (close-to-tray) cycles; Slack, Telegram, Bitwarden, udiskie and nm-applet items are unaffected.

🤖 Generated with Claude Code

StatusNotifierItem registrations come in three shapes in the wild: a
bare bus name, a bare object path (resolved against the sender), and a
combined "bus_name/object_path" string. Electron >= 43.4.1 (Chromium
150.0.7871.224) switched its tray registration to the combined form,
e.g.

    org.freedesktop.StatusNotifierItem-1234-1/StatusNotifierItem/1

The watcher only understood the first two shapes, so it ran
g_dbus_is_name() on the whole combined string, rejected the
registration with InvalidArgs, and the client tore down its tray icon:
Signal-Desktop 8.25+ (and anything else on Electron 43.4.1+) never
shows a tray icon. KDE's StatusNotifierWatcher accepts the combined
form.

Split the string at the first '/' when it does not start with one.

Fixes Alexays#5240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tray: "Invalid Status Notifier Item" for Electron 43+ SNI items using well-known bus names

2 participants