libappindicator breaks left-mouse actions for most applications

Bug #1910521 reported by Michael Wyraz
70
This bug affects 12 people
Affects Status Importance Assigned to Milestone
libappindicator (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Hello,

because GTK will drop tray icon support in version 4, many projects switch to libappindicator instead. Some are network-manager-applet, blueman-tray and electron (affecting all electron apps). The latter 2 automatically use libappindicator if it's available in the system.

For most applications, with libappindicator the tray icon behavior is broken (at least on archlinux with xfce4 and libappindicator-gtk3):

* left mouse button triggers the context menu rather than the left-mouse-button action
* the context menu is located beneath the mouse button, so when the mouse is released, the action is performed (in most cases "exit application").

Since the web is full of issue reports about this, I'm, pretty sure it's an issue in libappindicator itself than in every single application that uses it.

IMO this is a critical issue, especially for a library that provides tray support to applications.

Kind regards,
Michael.

Tags: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libappindicator (Ubuntu):
status: New → Confirmed
Changed in libappindicator (Ubuntu):
importance: Undecided → Low
Revision history for this message
Michael Wyraz (michael-wyraz) wrote :

@Sebastien, there are probably reasons for low priority. Nevertheless, there are hundreds of applications that suffer from this issue (e.g. google for "electron tray left click" - most are caused by this issue). And since gkt4 will drop direct api support, libappindicator becomes more important. Would you mind to re-think the priority?

Thank you,
Michael.

Revision history for this message
Sebastien Bacher (seb128) wrote :

The issue you describe doesn't happen on xubuntu with the indicator, trying nmapplet as an example the menu opens on top of the panel and not at the cursor location, also relaxing the click doesn't close it nor trigger the action. The placement and rendering of the menu would rather be an issue with the applet or desktop environment and not one of the library. The priority is low for Ubuntu since there is no report of such problems on Ubuntu despite indicator being enabled in the default desktop environments for almost a decade

Revision history for this message
Philipp Keck (philipp-v) wrote :

> doesn't happen on xubuntu with the indicator

But it does happen on Ubuntu.

> The priority is low for Ubuntu since there is no report of such problems on Ubuntu

Here comes that report. To reproduce:
1. Download the latest Ubuntu (21.04, live stick is enough).
2. Download and open Joplin (https://github.com/laurent22/joplin/releases/download/v1.7.11/Joplin-1.7.11.AppImage), which is an app that uses Electron and therefore libappindicator.
3. In the Options under Application enable "Show tray icon", which should show up at the top right of the screen.
4. Left-click on the icon. Observe how the context menu opens, just like with a right click, even though the application should open the main window instead (https://github.com/laurent22/joplin/blob/80b16dd17e227e3f538aa221d7b6cc2d81688e72/packages/app-desktop/ElectronAppWrapper.ts#L297-L299), and indeed it does so under Windows for example.

Revision history for this message
Frederick (frederickangelo) wrote :

The fucking tray icon doesn't work. Please for the love of god. I'm just trying to left click to open my app.

App:
Element Element version: 1.7.32.

Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3
Kernel Version: 5.12.15-xanmod1 (64-bit)
Graphics Platform: Wayland
Processors: 12 � AMD Ryzen 5 3600 6-Core Processor
Memory: 15,6 GiB of RAM
Graphics Processor: AMD Radeon HD 7800 Series

Revision history for this message
Andrey Radchishin (andreyrd) wrote :

This is a huge problem affecting many distros, including of course Ubuntu, that rely on this package. You can see tons of people reporting this across the web. So why is this low priority?

Revision history for this message
Andrey Radchishin (andreyrd) wrote :
Revision history for this message
Tomas Janco (janci007) wrote :

I experimented with implementing the Activate method, it gets called when left-clicking the status icon. But there is nothing to activate when Activate is called.
AppIndicator has a "menu" reference, but "menu" can not be activated, only MenuItem.
AppIndicator itself can not be activated as well.
(Or nobody listens for that signals)

The half-assed workaround Electron is doing is to create a dummy MenuItem, with label set the same as the status icon tooltip and add a "click-action-item" flag.

https://github.com/electron/electron/blob/8532e1239ec929e31b764ffcd314c8db3e09a19f/shell/browser/ui/gtk/app_indicator_icon_menu.cc#L65

But this item never gets actually added to the Menu, as HasClickAction always returns false.
https://github.com/electron/electron/blob/8532e1239ec929e31b764ffcd314c8db3e09a19f/shell/browser/ui/tray_icon_gtk.cc#L64

Note: "SecondaryActivate" is only called on middle-button click. On right click, the menu is open directly, without any method called on the AppIndicator DBus. On left click, the "Activate" method is called if it exists. (at least in KDE Plasma 5.24.6)

Revision history for this message
Tomas Janco (janci007) wrote :

I succesfully tested the changes with custom build of Electron, will do a pull request for Electron soon. Here is the libappindicator patch

Revision history for this message
Tomas Janco (janci007) wrote :

The relevant Electron PR is here: https://github.com/electron/electron/pull/35319

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Add support for Activate method to AppIndicator" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Tomas Janco (janci007) wrote :

The Electron team is willing to accept the PR when this is fixed in libappindicator first.
https://github.com/electron/electron/pull/35319#pullrequestreview-1072278155

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.