Comment 8 for bug 1910521

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)