Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
pdf opened this issue Jan 10, 2024 · 9 comments

Comments

@pdf
Copy link

pdf commented Jan 10, 2024

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
#15536 (comment)

@pdf pdf added the bug 🪲 label Jan 10, 2024
@codebytere codebytere added 28-x-y 29-x-y blocked/need-repro Needs a test case to reproduce the bug labels Jan 16, 2024
@electron-issue-triage
Copy link

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 blocked/need-repro Needs a test case to reproduce the bug 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.

@pdf
Copy link
Author

pdf commented Jan 16, 2024

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

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Jan 16, 2024
@jkleinsc jkleinsc added the blocked/need-repro Needs a test case to reproduce the bug label Mar 19, 2024
@dtrunk90
Copy link

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

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Mar 20, 2024
@jkleinsc jkleinsc added the blocked/need-repro Needs a test case to reproduce the bug label Mar 20, 2024
@electron-issue-triage
Copy link

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.

@electron-issue-triage electron-issue-triage bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
@pdf
Copy link
Author

pdf commented Mar 31, 2024

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

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Mar 31, 2024
@dtrunk90
Copy link

dtrunk90 commented Mar 31, 2024

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?

@azvyae
Copy link

azvyae commented Apr 6, 2024

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

image

@Reginald-Gillespie
Copy link

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

@MarshallOfSound
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: 👍 Does Not Block Stable
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

8 participants
@pdf @jkleinsc @dtrunk90 @codebytere @MarshallOfSound @azvyae @Reginald-Gillespie and others