Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

nm-applet tray icon displays left click menu on right click

Open donbex opened this issue 3 years ago • 2 comments

Under X11 with the XEmbed API, NetworkManager's nm-applet tray icon has two menus: a left click menu to choose and edit available connections, and a right click menu to toggle some extra options, most notably enabling and disabling ethernet or wi-fi devices.

However, with Waybar under Sway both left and right clicking on the nm-applet tray icon (with the AppIndicator API) results in the left click menu being shown. To be honest, though, I'm not sure whether the fault lies with nm-applet or with Waybar.

donbex avatar Jul 10 '20 14:07 donbex

It's complicated.

StatusNotifierItem spec allows context menu on right click and custom action on left click. Right click menu is received over dbus and rendered on a waybar side (which is a prerequisite for correct positioning of the menu). Left click handler lacks such facilities, therefore anything you can assign to the left click would be rendered by the application itself and positioned independently of waybar (there's no global positioning or relative positioning between unrelated windows in Wayland).

nm-applet --indicator implements AppIndicator specification which mysteriously omits certain methods and properties. Most notably it lacks Activate method for a separate left click handler. As a result, any SNI tray implementations are forced to process left and right clicks for appindicator tray items in the same way - by displaying context menu.

tl;dr: this cannot be achieved with all the limitations of DBus tray protocols. XEmbed may work through xembedsniproxy and render menus with artifacts and glitches at a random position.

alebastr avatar Jul 10 '20 17:07 alebastr

I don't know if this is also appindicator related, but I have 2 icons in tray, one, for transmission-gtk and one for gammastep-indicator and left-clicking on them behave like right-click. Left-clicking transmission icon should show/hide the application but instead open right-click menu. Same for gammastep, left click should enable/disable gamma correction but instead show right-click menu.

yannfill avatar Jul 01 '22 12:07 yannfill

also a problem for sc-controller, which brought me here. unfortunately some apps that use "close to tray" use left-click to re-show the window, meaning that after a close to tray the application window cannot be recovered.

adlainewson avatar Oct 31 '22 10:10 adlainewson