DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.61k stars 175 forks source link

StatusIcon is not displayed in GNOME + Wayland #1606

Open xinyazhang opened 8 years ago

xinyazhang commented 8 years ago

Version: 0.7.2-2 Environment: Fedora 24, Wayland Procedure to reproduce: enable 'Close minimizes to tray' and click the close button, deadbeef player simple disappears.

Possible reason: I took a look at the minimization (or iconify) code. It calls gtk_widget_hide when minimizing to tray is enable. However the Gtk APIs designed for this function are

void
gtk_window_iconify (GtkWindow *window);

and

void
gtk_window_deiconify (GtkWindow *window);
xinyazhang commented 8 years ago

By the way, the tray icon never shows up ("Hide system tray icon" is enabled). However, thunderbird shows the icon correctly.

I'm looking into this issue.

xinyazhang commented 8 years ago

Apparently this is a Wayland-specific issue. Under X11 works without problems. Since Wayland isn't default, it's very likely to be a gnome's bug.

Oleksiy-Yakovenko commented 8 years ago

I took a look at the minimization (or iconify) code. It calls gtk_widget_hide when minimizing to tray is enable. However the Gtk APIs designed for this function are

It's because when an app "minimizes" to sys tray -- it doesn't really minimize or iconify.

I don't know much about wayland and how its system tray implementation works..

Basically, your problem is not what you wrote.. it's that there's no tray icon at all.

The old GTK status icon API is deprecated, so relatively recently deadbeef got a new plugin https://github.com/Alexey-Yakovenko/deadbeef/tree/master/plugins/statusnotifier

This is only available on master branch, so this may explain why it doesn't work if you're using 0.7.2

xinyazhang commented 8 years ago

Thanks for you reply.

After some research I found the real problem is Wayland has removed system tray completely (Gnome leaves the tray exclusively for X11 apps).

It seems the proposed solutions by DEs (at least Gnome) is to support MPRIS2 Quickly Access Media Controls, and at least Rhythmbox is working in this way. Thus shall we change this issue as "Mainline MPRIS2 plugin"?

Thank you.

Oleksiy-Yakovenko commented 8 years ago

They are 2 different things.

There's still notification area in KDE5, GNOME3, etc, and it works in deadbeef with the new plugin that I mentioned.

Then there's the Ubuntu sound menu, and similar in other desktops, which are not supported by Deadbeef natively, but there are multiple third party plugins and scripts, which have been available for quite a while.

I'm not convinced to support MPRIS stuff as part of my tree yet, but feel free to post a feature request about it.

xinyazhang commented 8 years ago

I totally agree. They are really two different things, but the problem is, from my testing the KDE plugin doesn't work under Gnome 3, while the third-party mpris2 plugin has no problem in presenting status in Gnome.

statusnotify without mpris2

mpris2 with statusnotify disabled

After taking a look at the statusnotify code, it seems this plugin employs KDE specific D-Bus interfaces ("org.kde.StatusNotifierItem"), and there isn't corresponding interface in Gnome 3 yet.

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang I just tried in GNOME3 which ships in Ubuntu 16.04, and the standard GtkStatusIcon works just fine. It appears in the bottom left corner, like this:

image

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang

I can't find any information, whether this notification area is still present in wayland version of GNOME shell, or what kind of protocol it's using.

Oleksiy-Yakovenko commented 8 years ago

@ugilio Hey mate, hope it's all right that I'm summoning you.

I tried to figure out why the statusnotifier plugin doesn't work in Ubuntu (Unity)...

Can't find any reason for that. I tried adding more properties to XML, like this:

        "    <property type='s' name='IconThemePath' access='read'/>"
        "    <property type='o' name='Menu' access='read'/>"
        "    <property type='b' name='ItemIsMenu' access='read'/>"

and handling them like this (hack-ish):

    else if (g_strcmp0(property_name, "IconThemePath") == 0)
        ret = g_variant_new_string("/usr/share/icons/hicolor");
    else if (g_strcmp0(property_name, "Menu") == 0)
        ret = g_variant_new_object_path ("/org/deadbeef/StatusNotifier/Menu");
    else if (g_strcmp0(property_name, "ItemIsMenu") == 0)
        ret = g_variant_new_boolean(FALSE);

Still couldn't get it to work.

Can you give me a pointer how to debug this stuff? Are there any tools to monitor what's going and where it fails?

Oleksiy-Yakovenko commented 8 years ago

@ugilio I found this in dbus-monitor output:

method call time=1467720327.895196 sender=:1.33 -> destination=org.freedesktop.DBus serial=178 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=StartServiceByName
   string "org.kde.StatusNotifierItem-23958-1"
   uint32 0
error time=1467720327.895237 sender=org.freedesktop.DBus -> destination=:1.33 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=178
   string "The name org.kde.StatusNotifierItem-23958-1 was not provided by any .service files"

does this mean that Unity doesn't support this protocol at all, or is it something wrong on Deadbeef's side?

Oleksiy-Yakovenko commented 8 years ago

more info...

$ tail -f ~/.cache/upstart/indicator-application.log

(process:1781): indicator-application-service-WARNING **: Notification Item on object /StatusNotifierItem of org.kde.StatusNotifierItem-29924-1 doesn't have enough properties.

apparently, I'm still missing some required properties

Oleksiy-Yakovenko commented 8 years ago

Ahh.. I'm wrong, this message disappears when I add the IconThemePath, Menu and ItemIsMenu.

So I'm on the right way, but still not quite there.. Probably need to actually have some sort of Menu object initialized, but didn't figure out how to do this yet.

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang btw, could you please try if this plugin works with wayland?

https://github.com/vovochka404/deadbeef-statusnotifier-plugin

It uses the same protocol as the built-in status notifier, but seems to be more complete, and works in Ubuntu/Unity at least.

I suppose it should work in GNOME too.

Oleksiy-Yakovenko commented 8 years ago

I tracked it down to the Menu property.. it needs to be a valid GObject path, with an associated DBUS service, which serves the menu, and this could be implemented with the library called "dbusmenu-glib", which is quite a bad dependency to bring.

Oleksiy-Yakovenko commented 8 years ago

I suppose we can repurpose this issue for tracking Unity progress with statusnotifier plugin...

xinyazhang commented 8 years ago

@Alexey-Yakovenko I believe Gnome has removed system tray icon support for all Wayland Applications, and there is also a bug report for Lantern for this problem. This design has been proposed long time ago, but it looks they tried to keep the tray icon working for all X11 applications, for the sake of compatibility, and drop the support for Wayland applications from the beginning.

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang so there's no system tray at all in GNOME shell on wayland?

Can anyone of people who has access to a system running wayland + GNOME confirm?

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang it looks like you are correct about it, I'm updating the issue title to reflect this.

Your bug report doesn't make sense anymore, because if GNOME ditched the status icon support completely -- then nothing can be done on application side.

MPRIS plugin can be used, if needed, and Deadbeef seems to be satisfying all of the guidelines, even with default settings.

xinyazhang commented 8 years ago

No, I tried vovochka404's plugin, but the status icon still doesn't present.

Oleksiy-Yakovenko commented 8 years ago

I feel like stealing this thread for an unrelated issue (Unity appindicator) was wrong. Will make a new issue, and close this.

xinyazhang commented 8 years ago

@Alexey-Yakovenko The actual problem is, we need some method similar with "minimizing to tray" to let deadbeef run in background. If both mpris2 and status icon failed to present (that's the case of the git master without 3rd party plugins), after "minimizing" the main UI will simply disappear and there is no way to get it back besides running it again.

Oleksiy-Yakovenko commented 8 years ago

@xinyazhang

The actual problem is, we need some method similar with "minimizing to tray" to let deadbeef run in background.

No, we don't. There's no tray in GNOME. Deadbeef can still run "in background" by hiding the main window, but this will remain disabled by default.

Then, the GNOME guidelines explicitly say that apps should NOT do that:

Applications can run without a window under GNOME 3. However, they are only recommended to do so when: The application does not play sound or music.

xinyazhang commented 8 years ago

@Alexey-Yakovenko Got it, thank you.

sljunkie commented 7 years ago

I think GNOME + Wayland ignores the system tray completely; it's deprecated according to GNOME dev's.

On the other hand, the mpris2 plugin works wonders with deadbeef + GNOME 3 since media players that support it are fully integrated in the notification area (see screenshot). Perhaps deadbeef could include this plugin by default.

screenshot from 2017-02-02 05-05-30

AlexanderZhirov commented 7 months ago

Unfortunately, the icon does not appear in the system tray of the Budgie desktop environment.

2024-02-04_00-28