electron: [Bug]: Tray icon on Linux has chome id for all Electron applications (AppIndicator/StatusNotifierItem)

Preflight Checklist

Electron Version

28.0.0

What operating system are you using?

Other Linux

Operating System Version

Arch Linux

What arch are you using?

x64

Last Known Working Electron version

22.x

Expected Behavior

For various desktop environments to function correctly, every registered AppIndicator must have a unique, stable ID attached to the StatusNotifierItem. Prior to the migration to StatusIconLinuxDbus implementation in #36333 the application name was used as the ID prefix.

Actual Behavior

All Electron applications use the same indicator ID value of chrome_status_icon_1, which breaks the functionality of desktop environments for managing tray icons like sorting, hiding, etc.

Testcase Gist URL

No response

Additional Information

See some examples of previous times this was fixed:

#5969 https://github.com/electron/electron/pull/15536#issuecomment-436019112

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 11
  • Comments: 26 (4 by maintainers)

Most upvoted comments

I’ve just marked this issue as stale-exempt which will remove the stale prompting.

This is just a hardcoded constant in Chrome, we should patch that and maybe even upstream that that id comes from Browser::GetName() or something instead to avoid x-embedder conflicts.

Ref: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc;l=105?q=chrome_status_icon_&ss=chromium

@codebytere I’m not an Electron developer, so I’m not sure off-hand how to write an Electron application that registers a system tray - I observed this behaviour of Electron apps when implementing an SNI host.

If it helps, here’s the DBUS dialog when any Electron application registers a tray icon to the SNI host, and is queried for its SNI id property - every Electron application returns the same result (though the last digit will increase if they for some reason register multiple tray icons AIUI):

method call time=1705437918.487533 sender=:1.456 -> destination=org.kde.StatusNotifierWatcher serial=49 path=/StatusNotifierWatcher; interface=org.kde.StatusNotifierWatcher; member=RegisterStatusNotifierItem
   string "org.kde.StatusNotifierItem-5-1"
method call time=1705437918.487726 sender=:1.13 -> destination=org.kde.StatusNotifierItem-5-1 serial=18192 path=/StatusNotifierItem; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "Id"
method return time=1705437918.487905 sender=:1.456 -> destination=:1.13 serial=50 reply_serial=18192
   variant       string "chrome_status_icon_1"

But the multiple times this has been fixed in previous implmementations of SNI as mentioned in the original issue should serve as illustration enough of the issue, no?

@Freeskier your comment was deleted as a violation of the Electron Code of Conduct. You may consider this an official warning.

Please do not interact with the project for 24 hours. After that, please look through your open issues and edit them to ensure they’re entirely on-topic, and we can continue the discussion here about the best way to go forward.

Open source is largely volunteer-driven and collaborative. Because of this, time and energy to get things done are often the scarcest resources. We want Electron to be the best that it can be, but we also have to be realistic about what the team maintaining Electron can achieve. This means that:

  • We might not have an ETA for when an issue will get investigated or fixed.
  • Something you want implemented might not get implemented.
  • A change you want merged might not get merged.
  • Insisting on or making demands for any of the above is considered against the Electron Code of Conduct

Not stale

@jkleinsc I understand this project is likely overwhelmed by issues, but if you could please read the previous comments and maybe provide some kind of response before re-adding the need-repro that would be great.

Unfortunately, without a way to reproduce this issue, we’re unable to continue investigation. This issue has been closed and will not be monitored further. If you’re able to provide a minimal test case that reproduces this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

Hello @pdf. Thanks for reporting this and helping to make Electron better!

Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone’s looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-repro label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.