You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tray click is not executed and it shows the context menu instead #14941
Same issue. Since Electron v3 at least on Linux tray clicking started to show the context menu instead of executing subscribed to tray click event handler. Worked as expected with Electron v2.
Btw on macOS tray click was opening a context menu even with Electron v2.
Same here, I receive the click event as soon as i click on the context menu which opens first after a click on the tray icon. Same problem on v3 and v4. Working fine with v2.
i reverted to v2.0.16, this is very important to have on a tray using app click event, maybe Atom, Visual Code it does not use the tray, but still on apps that have tray mostly, it should work on click, all linux apps work with the click and right click, but now on the docs, is says the tray click is ignore. but why?
different desktop environments have different typical behavior when clicking the tray icon. With electron 3, the tray icon behavior is now the same on all desktop environments that I've checked (Unity, GNOME, Xfce, MATE, Cinnamon). It copies the Unity behavior in that both a left-click and a right-click opens the context menu. Having the left-click show a context menu is a major change in behavior for many users who expect the left-click to be an action. (e.g., focus the app or open an app that is closed to the tray). Additionally, users on Xfce and MATE (and potentially others) had unread message count when hovering over the tray icon. This hover functionally no longer exists with Electron 3.
Users on Ubuntu 18.04 (and later)/GNOME will not notice a change (although other GNOME users might) as Electron has code which masks the GNOME DE as Unity in order to have the Unity style libappindicator. (which is something that should be changed).
Yes, it's still an issue with latest versions of Skype, Discord and Slack. (I can't say what version of Electron they are using, because they don't report it on --version.)
It worked after the @chromium project switched to DBUS/StatusNotifier icon implementation (since Electron v8) and stopped working after the #23674 change.
It is really a shame, that this issue is still open more than 3 years after first complains.
I recently struggled with different tray implementations in one of my python apps too (Using KDE Plasma as a DE).
After finally having this solved (see list below), I was eager to fix it for element-web too (element-hq/element-web#11772). But it looks like it is an upstream issue with electron itself, affecting many "electronized" apps.
So far, I tried the following tray indicators with different pros and cons:
LibAppIndicator is used by many projects for the tray icon but only display the context menu, no matter if you click left or right
GTKStatusIcon shows the correct behavior but is flagged deprecated and will be removed in newer GTK versions
XAppStatusIcon finally distinguishes again between left & right click. However I never was able to get the tray icon to a decent resolution (always looked like an ugly upscaled 16x16 px image)
QSystemTrayIcon finally allowed me to have right/left clicks behaving differently + a high resolution of the tray icon. But that needs the Qt framework to be installed. And I'm unsure, if this will also have the expected behavior on GTK based DEs (I guess/hope so?)
If QSystemTrayIcon works across different DEs with the left & right click differentiation, it might be worth to give this a try.
Not to pile on here, but... yeah, this is an issue. Users do typically expect left- and right-click actions to do different things.
Also, when libappindicator is not installed, this works the "right" way (i.e. left-click detection works), but installing it — even as a dependency for an unrelated package — breaks existing Electron tray icons, as described above. This, in itself, is incredibly annoying.
Reacted by Ciprian Dorin Craciun, hurradiegams, Robbie Wagner and kupiqu
The libappindicator is not implementing "Activate" method.
But then there is not handler to call in Electron by that "Activate"
There is code for creating a dummy MenuItem that will represent the left-click action,
but it is not really created because HasClickAction returns false
Not to pile on here, but... yeah, this is an issue. Users do typically expect left- and right-click actions to do different things.
Also, when libappindicator is not installed, this works the "right" way (i.e. left-click detection works), but installing it — even as a dependency for an unrelated package — breaks existing Electron tray icons, as described above. This, in itself, is incredibly annoying.
At least there should be a way to disable this behavior via an environment variable - env vars are an extremely cheap way to add configurability.
Unfortunately, libayatana-appindicator has the same issue of not differentiating between left-click and right-click and potentially other activation methods. The issue seems to be dead AyatanaIndicators/libayatana-appindicator#4
In the meantime I investigated how QT is handling tray icons - it is directly talking to DBUS interface according to https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/ specification.
As the protocol is simple, wouldn't talking directly to DBUS without half-assed intermediate library nicely solve this problem?
Hi,
on linux Mageia with gnome desktop, schildichat electron app don't display anymore icon in systray, i'm not a dbus expert and perhaps i misunderstood between kernel or kde of kdbus, because under plasma/kde icon is here why using kdbus : https://github.com/search?q=org%3Aelectron+StatusIconLinuxDbus&type=code
Activity
p3x-robot commentedon Oct 3, 2018
the code:
https://github.com/patrikx3/onenote/blob/master/src/electron/main/create/tray.js#L6
https://github.com/patrikx3/onenote/blob/master/src/electron/main/action.js#L24
p3x-robot commentedon Oct 3, 2018
now on this line:
https://github.com/patrikx3/onenote/blob/master/src/electron/main/create/tray.js#L11
when i click on the tray, it should show on the console, but it is not shown and instead on the click it shows to context menu, here:
https://github.com/patrikx3/onenote/blob/master/src/electron/main/create/tray.js#L16
Why does it show the context menu when i click on it, when i never requested it? THANKS VERY MUCH!
vladimiry commentedon Nov 3, 2018
Same issue. Since Electron v3 at least on Linux tray clicking started to show the context menu instead of executing subscribed to tray
clickevent handler. Worked as expected with Electron v2.Btw on macOS tray click was opening a context menu even with Electron v2.
raffis commentedon Dec 6, 2018
Same here, I receive the click event as soon as i click on the context menu which opens first after a click on the tray icon. Same problem on v3 and v4. Working fine with v2.
p3x-robot commentedon Dec 26, 2018
this acutally is happening with electron 4 as well, it was working in v2
p3x-robot commentedon Dec 26, 2018
@sofianguy would you please add that version 4 is the same error as well?
p3x-robot commentedon Dec 29, 2018
i reverted to v2.0.16, this is very important to have on a tray using app click event, maybe Atom, Visual Code it does not use the tray, but still on apps that have tray mostly, it should work on click, all linux apps work with the click and right click, but now on the docs, is says the tray click is ignore. but why?
As the docs says: https://electronjs.org/docs/api/tray#class-tray
When app indicator is used on Linux, the click event is ignored.
vladimiry commentedon Dec 30, 2018
@sofianguy can the 4-0-x label be added here?
p3x-robot commentedon Jan 2, 2019
How come in v2 it is working then weirdly in v3 and v4 it says app indicator click event is ignored. That is 100% false!
TGWKE commentedon Jan 12, 2019
different desktop environments have different typical behavior when clicking the tray icon. With electron 3, the tray icon behavior is now the same on all desktop environments that I've checked (Unity, GNOME, Xfce, MATE, Cinnamon). It copies the Unity behavior in that both a left-click and a right-click opens the context menu. Having the left-click show a context menu is a major change in behavior for many users who expect the left-click to be an action. (e.g., focus the app or open an app that is closed to the tray). Additionally, users on Xfce and MATE (and potentially others) had unread message count when hovering over the tray icon. This hover functionally no longer exists with Electron 3.
Users on Ubuntu 18.04 (and later)/GNOME will not notice a change (although other GNOME users might) as Electron has code which masks the GNOME DE as Unity in order to have the Unity style libappindicator. (which is something that should be changed).
p3x-robot commentedon Jan 13, 2019
it is 100%, that the tray will come back with right left and right click as it should. unity is not the best desktop. i am certain.
70 remaining items
MartinX3 commentedon Mar 8, 2022
It worked with signal in the past. That must be a regression there.
cipriancraciun commentedon Mar 8, 2022
Yes, it's still an issue with latest versions of Skype, Discord and Slack. (I can't say what version of Electron they are using, because they don't report it on
--version.)mykhi commentedon Mar 8, 2022
Same for me, it's been so long I started to forget that left click used to work as left click.
vladimiry commentedon Mar 8, 2022
It worked after the @chromium project switched to DBUS/StatusNotifier icon implementation (since Electron v8) and stopped working after the #23674 change.
systemofapwne commentedon Apr 1, 2022
It is really a shame, that this issue is still open more than 3 years after first complains.
I recently struggled with different tray implementations in one of my python apps too (Using KDE Plasma as a DE).
After finally having this solved (see list below), I was eager to fix it for element-web too (element-hq/element-web#11772). But it looks like it is an upstream issue with electron itself, affecting many "electronized" apps.
So far, I tried the following tray indicators with different pros and cons:
LibAppIndicatoris used by many projects for the tray icon but only display the context menu, no matter if you click left or rightGTKStatusIconshows the correct behavior but is flagged deprecated and will be removed in newer GTK versionsXAppStatusIconfinally distinguishes again between left & right click. However I never was able to get the tray icon to a decent resolution (always looked like an ugly upscaled 16x16 px image)QSystemTrayIconfinally allowed me to have right/left clicks behaving differently + a high resolution of the tray icon. But that needs the Qt framework to be installed. And I'm unsure, if this will also have the expected behavior on GTK based DEs (I guess/hope so?)If QSystemTrayIcon works across different DEs with the left & right click differentiation, it might be worth to give this a try.
LRitzdorf commentedon Apr 27, 2022
Not to pile on here, but... yeah, this is an issue. Users do typically expect left- and right-click actions to do different things.
Also, when libappindicator is not installed, this works the "right" way (i.e. left-click detection works), but installing it — even as a dependency for an unrelated package — breaks existing Electron tray icons, as described above. This, in itself, is incredibly annoying.
janci007 commentedon Aug 11, 2022
The libappindicator is not implementing "Activate" method.
But then there is not handler to call in Electron by that "Activate"
There is code for creating a dummy MenuItem that will represent the left-click action,
but it is not really created because HasClickAction returns false
electron/shell/browser/ui/tray_icon_gtk.cc
Line 64 in 8532e12
It needs to be fixed both in AppIndicator and Electron
For more details, see:
https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1910521/comments/8
Rush commentedon Aug 11, 2022
At least there should be a way to disable this behavior via an environment variable - env vars are an extremely cheap way to add configurability.
dima4p commentedon Aug 11, 2022
Additionally, it would be great if all kde5 developers refer sometimes to how kde4 works…
edlerd commentedon Sep 26, 2022
I see in Ubuntu 22.04 there is no trace of libappindicator. Instead, it uses
https://github.com/ubuntu/gnome-shell-extension-appindicator and
https://github.com/AyatanaIndicators/libayatana-appindicator
janci007 commentedon Sep 26, 2022
Unfortunately, libayatana-appindicator has the same issue of not differentiating between left-click and right-click and potentially other activation methods. The issue seems to be dead AyatanaIndicators/libayatana-appindicator#4
In the meantime I investigated how QT is handling tray icons - it is directly talking to DBUS interface according to https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/ specification.
As the protocol is simple, wouldn't talking directly to DBUS without half-assed intermediate library nicely solve this problem?
vladimiry commentedon Sep 26, 2022
#14941 (comment)
RobbieTheWagner commentedon Oct 25, 2022
Seems like a lot of people understand a fix here. Any possibility of opening a PR to fix it?
surfzoid commentedon Mar 8, 2023
Hi,
on linux Mageia with gnome desktop, schildichat electron app don't display anymore icon in systray, i'm not a dbus expert and perhaps i misunderstood between kernel or kde of kdbus, because under plasma/kde icon is here why using kdbus : https://github.com/search?q=org%3Aelectron+StatusIconLinuxDbus&type=code