iovxw / ksni

A Rust implementation of the KDE/freedesktop StatusNotifierItem specification
The Unlicense
69 stars 11 forks source link

Left click to open the context menu #19

Open nohajc opened 9 months ago

nohajc commented 9 months ago

How can I make left click open the menu the same as right click? I assume it means implementing the correct activate action although it is not clear to me what exactly to call there.

iovxw commented 9 months ago

There is an org.freedesktop.StatusNotifierItem.ItemIsMenu

BOOL: The item only support the context menu, the visualization should prefer showing the menu or sending ContextMenu() instead of Activate()

But nobody uses it, not even KDE https://github.com/KDE/kstatusnotifieritem/blob/f03e80da107c80d28662995ad2b9f1214902b3fa/src/kstatusnotifieritemdbus_p.cpp#L161

GNOME uses an unstandardized approach that seems incompatible with other implementations https://github.com/ubuntu/gnome-shell-extension-appindicator/blob/e365c01682bc77e31c10b82fe9169817215838b3/appIndicator.js#L780

So this may not be possible at the moment

nohajc commented 9 months ago

Well, it actually works if I use this go library:

https://github.com/fyne-io/systray

I haven't figured out yet how they do it though...

iovxw commented 9 months ago

Well, it actually works if I use this go library:

https://github.com/fyne-io/systray

I haven't figured out yet how they do it though...

It uses the ItemIsMenu

What desktop environment (and the tray plugin, if any) are you using?

nohajc commented 9 months ago

I tested with Fedora 39 KDE and the left click worked which is really interesting given what you said.

So maybe there is yet another trick...

nohajc commented 9 months ago

I also forked your repo and tried this yesterday but the change had no effect: https://github.com/nohajc/ksni/commit/314027c0a4fe9d4023702f95d4657ccfafd21c75

So yeah, the fyne-io/systray library must be doing something differently and I'd be interested in figuring out what it is. Otherwise it is not really an issue with your project... maybe a feature request.

wusyong commented 5 days ago

Hey sorry if my question is irrelevant. But could this crate being used as a context menu or popup menu? I mean the menu when people right click in the window. Or is there any other freedesktop spec I should look for?