electron icon indicating copy to clipboard operation
electron copied to clipboard

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

Open pdf opened this issue 1 year ago • 15 comments

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

pdf avatar Jan 10 '24 09:01 pdf

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.

@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?

pdf avatar Jan 16 '24 20:01 pdf

Any updates on the issue ?

ZenithMonk avatar Mar 09 '24 10:03 ZenithMonk

Facing this issue on a Budgie Desktop with the AppIndicator Applet. Starting multiple electron based apps results in picking the same icon for all of them from the first started application: VirtualBox_Debian 12_20_03_2024_21_43_16

dtrunk90 avatar Mar 20 '24 20:03 dtrunk90

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.

@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.

pdf avatar Mar 31 '24 01:03 pdf

Not sure why you need a reproduction for that, but here you go:

const { app, Menu, Tray, nativeImage } = require('electron')
const path = require('node:path')

let appIcon = null
app.on('ready', function(){
  appIcon = new Tray(nativeImage.createFromPath(path.join(__dirname, '1.png')))
});

Also, attached are 2 projects with different tray icons: electron-issue-40936-repro.tar.gz

You can run both on Ubuntu Budgie 23.10 to reproduce the issue mentioned in my previous comment. You'll see the icon from the first started application is used for both tray icons.

Could you please take issues like these more serious instead of let us talking to a bot and ignoring/not reading the issue at all?

dtrunk90 avatar Mar 31 '24 15:03 dtrunk90

Bump, still happened on electron 29. I have whatsapp electron and anytype electron, both ids using same chrome_status_icon_1 id

image

azvyae avatar Apr 06 '24 17:04 azvyae

Same issue, I originally thought this was unique to these apps until it was pointed out that it might be an electron issue. Both obsidian and discord minimize with no ID on arch linux plasma 6, wayland: image

Reginald-Gillespie avatar Apr 11 '24 13:04 Reginald-Gillespie

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

MarshallOfSound avatar Apr 11 '24 17:04 MarshallOfSound

👀

ilobilo avatar Jun 22 '24 18:06 ilobilo