Bug 470840 - Setting the tray icons of some Electron apps, like Discord, to "always hidden" or any setting applies to ALL Electron apps' tray icons, not just the one
Summary: Setting the tray icons of some Electron apps, like Discord, to "always hidden...
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray widget (show other bugs)
Version: 6.1.5
Platform: Arch Linux Linux
: HI normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 468319 492846 494526 498662 500238 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-06-09 17:24 UTC by Alexander Sanderson
Modified: 2025-03-26 10:35 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Showcase (icons) (3.63 KB, image/png)
2024-09-15 15:20 UTC, Damglador
Details
Showcase (settings) (12.73 KB, image/png)
2024-09-15 15:21 UTC, Damglador
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Sanderson 2023-06-09 17:24:43 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Have multiple Electron apps with tray icons open, e.g. Discord and Element
2. Right click the system tray and select "Configure System Tray"
3. Set Discord's tray icon to "always hidden"

OBSERVED RESULT
The tray icon for Discord AND Element are hidden

EXPECTED RESULT
The tray icon for only Discord is hidden, while Element's remains because the user did not set Element's to "always hidden"

SOFTWARE/OS VERSIONS
Linux: Arch Linux
(available in About System)
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-06-09 19:02:24 UTC
Are both apps distro-packaged apps, or both Flatpak or Snap, or both installed from different packaging systems?
Comment 2 Nicolas Fella 2023-06-10 14:13:36 UTC
Tl;DR Electron bad

Both register their StatusNotifierItem with Id "chrome_status_icon_1". Plasma uses the Id to store which ones are hidden, so changing one will affect both
Comment 3 Nate Graham 2023-06-13 21:15:32 UTC
Is there some alternative metadata we can take into account in this kind of ambiguous case?
Comment 4 David Edmundson 2023-06-13 21:26:33 UTC
>Is there some alternative metadata we can take into account in this kind of ambiguous case?

You do have the host dbus address, from that we can query the PID, from that we can get anything we normally get from a PID.

We would have to hardcode the case of getting "chrome_status_icon_1" to know when to look for alternative metadata, so it's extremely hacky. 

As a non-hack, patch chrome?
Comment 5 Nate Graham 2023-06-13 21:29:40 UTC
Fixing chrome would be ideal, yeah.

But in principle a collision could happen with other apps too, so I don't think we would necessarily have to hardcode a check for "chrome_status_icon_1".  Instead, check if there are any non-unique Id values, and for those, apply the disambiguating factor.
Comment 6 David Edmundson 2023-06-13 21:35:12 UTC
>Instead, check if there are any non-unique Id values, and for those, apply the disambiguating factor.

I don't see how that can work. 

I run discord, I save a setting, I close discord.
I then run electron. 

From a Plasma POV have I just opened electron or have I opened chrome again?
Comment 7 David Edmundson 2023-06-13 21:35:48 UTC
* opened Discord again
Comment 8 Nate Graham 2023-06-13 21:43:49 UTC
Oh, I see what you mean. Yeah.
Comment 9 Bennett Kanuka 2023-08-08 18:33:03 UTC
This is a bug in Electron or Chrome right?  The indicator Id should be set to something related to the name of the app rather than blanket `chrome_status_icon_1` for all apps. 

Some time ago (~7 years) there was a fix submitted to Electron to set the tray icon id to the app name: https://github.com/electron/electron/pull/6145/files  Obviously the APIs used here are long out of date, but this possibly confirms that this should be handled in Electron (?)

Note that can't find anything in the electron docs for manually setting tray icon id, but if there was a way of setting this from the electron app, then this could possibly be fixed in each individual app by explicitly setting an id.
Comment 10 cwo 2024-09-14 07:16:36 UTC
*** Bug 492846 has been marked as a duplicate of this bug. ***
Comment 11 Damglador 2024-09-15 15:20:07 UTC
Created attachment 173690 [details]
Showcase (icons)
Comment 12 Damglador 2024-09-15 15:21:20 UTC
Created attachment 173691 [details]
Showcase (settings)

Signal - show if needed
Teams - always show
Discord - always hide
Comment 13 Damglador 2024-09-15 15:23:46 UTC Comment hidden (spam)
Comment 14 Konrad Materka 2024-10-11 17:37:01 UTC
*** Bug 468319 has been marked as a duplicate of this bug. ***
Comment 15 Konrad Materka 2024-10-11 21:10:13 UTC
*** Bug 494526 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2025-01-14 22:16:07 UTC
*** Bug 498662 has been marked as a duplicate of this bug. ***
Comment 17 Wiktor J 2025-02-17 10:06:35 UTC
*** Bug 500238 has been marked as a duplicate of this bug. ***