iovxw / ksni

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

custom dbus name for StatusNotifierWatcher #24

Open mokurin000 opened 4 months ago

mokurin000 commented 4 months ago

This is for flatpak packaging. If we own org.kde.StatusNotifierItem-2-1, it will be tricky: it's not guaranteed that my app will have PID 2. As workarounds from chromium, instead we register a existing dbus name we are using, and everything works fine.

To address this, just use the default bus name we were given on initially connecting to the bus. This violates the spec, but there's actually no consequence for doing this.

eminfedar commented 4 months ago

I have problems with flatpak too and probably related to this.

I don't have any problem when I add "--socket=session-bus" to finish-args. But flathub doesn't like "I can talk anything" permission.

When I removed "--socket=session-bus" and only "--talk-name=org.kde.StatusNotifierWatcher" left, I got D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (org.freedesktop.DBus.Error.ServiceUnknown)

mokurin000 commented 4 months ago

I have problems with flatpak too and probably related to this.

I don't have any problem when I add "--socket=session-bus" to finish-args. But flathub doesn't like "I can talk anything" permission.

When I removed "--socket=session-bus" and only "--talk-name=org.kde.StatusNotifierWatcher" left, I got D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (org.freedesktop.DBus.Error.ServiceUnknown)

did you try https://github.com/waylyrics/ksni/tree/feat-custom-dbus-name

eminfedar commented 3 months ago

0.2.2 update and run_without_dbus_name() solved my problem.