-
Notifications
You must be signed in to change notification settings - Fork 15k
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
fix: libappindicator left-click support #35319
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm good with this change, I think we should wait for maintainer's response on the upstream issue first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with improving how Electron behaves on systems with libappindicator installed, but do want to point out that libappindicator is (IIUC) a dead legacy package. Does this patch change behavior on modern Linux desktops that don't ship with libappindicator?
What modern Linux desktops do you mean and what is the replacement to libappindicator? In my experience many apps ship with libappindicator dependencies - many electron apps (slack, teams) and some native (remmina) use libappindicator. If libappindicator is present on the system, electron will load it and use it and break the left-click behavior. It actually works fine when libappindicator is not present. This change should not affect systems without libappindicator - changes were made in files belonging to libappindicator variant of tray icon implementation. |
I should've been more careful with my wording; calling other desktops "modern" doesn't imply anything pejorative about desktops with libappindicator. I'm in favor of patches that help Electron to behave well on older systems as well. To answer your question, I was thinking of Ubuntu. I don't believe that 22.04 ships with libappindicator. |
AFAIK libappindicator is in the ubuntu 22.04 repo but is not installed with the default desktop environment. It will be pulled in if any app with libappindicator dependency is installed. Do you know what is a possible replacement to libappindicator? (Please understand I would be more than happy if the libappindicator library would be wiped out of existence, it's just not something we can make happen.) If there really is a replacement for libappindicator, Electron can use it in preference to libappindicator. It is not the case now - it will use libpappindicator whenever it is available in the system. That would be better solution to the left-click problem, as this fix depends on libappindicator accepting the fix mentioned before and it seems to be stalled. |
To be honest, I've never thought this is an upstream issue seeing a lot of apps on XFCE actually doing custom actions on left-click. But even with the XFCE users have a choice to force showing right-click popup on left-click, so maybe it's still up to DE and their software to represent a From what I understand by looking at this code on upstream GitLab repository, there seems that no matter of the method, it is always invoked, so if somehow the Activate method is emitted (I guess that is dependant on the DE), From my perspective, it's been always that weird Electron limitation I did not understand when comparing Electron apps to native ones. This is why I'd love to see this PR merged even before upstream will define a logic for Activate (at least not call it unknown) if it doesn't break with the current
Other than |
libappindicator is just sending dbus messages under the hood, we can of course send raw messages in Electron instead of relying on libappindicator. Chromium has actually removed uses of libappindicator and is sending raw dbus messages in their implementation: |
|
Description of Change
There is a long-standing issue of left-click on tray icon not working on Linux when libappindicator is installed
#14941
This PR along with a libappindicator patch
(in progress here https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1910521 )
enables the Activate event of tray icon to be propagated into electron app.
This builds on already implemented solution of creating a replacement menu item in systray menu that will be triggered if the tray icon is clicked. This code was activated and adapted to create the replacement item as hidden.
In libappindicator, the relevant Activate method was implemented and will trigger activation of this replacement menu item.
Checklist
npm test
passesRelease Notes
Notes: Added support for left-click app activation when using libappindicator based tray icon