Bug 489910 - Notifications sent by Quod Libet music player stop being shown by Plasma after a little while, though they continue to be sent by the app
Summary: Notifications sent by Quod Libet music player stop being shown by Plasma afte...
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (other bugs)
Version First Reported In: 6.1.2
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-08 09:35 UTC by Alexander Wilms
Modified: 2025-03-29 16:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Wilms 2024-07-08 09:35:31 UTC
SUMMARY
Quod Libet has a plugin "Send Notifications" that uses the org.freedesktop.Notifications D-Bus interface. However, often the notifications are not shown or they only appear in the history of notifications with the bell icon being animated.

The notification settings for Quod Libet are as follows:
Show popups - enabled
Show in do not disturb mode - enabled
Show in history - enabled
Show notification badges - enabled

STEPS TO REPRODUCE
1. Install Quod Libet and Bustle (a tool to watch D-Bus messages) and start both
2. Add music directory
3. Enable File > Plugins > Song Notifications
4. Set "Show notifcations" to "On all song changes"
5. Disable "Only when the main window is not focused"
6. Record session bus in Bustle
7. Click "Show notification" in the Plugin settings or play song and then click "Next"

OBSERVED RESULT
Often no notification

Still, Bustle shows the following messages on the session bus:

Method Call:
("Quod Libet", uint32 38, "file:///tmp/cover-l6_prx37.jpg", "Gnarls Barkley - Crazy", "2∶57\nSt. Elsewhere\n2006", @as [], {"desktop-entry": <"io.github.quodlibet.QuodLibet">, "image-path": <"file:///tmp/cover-l6_prx37.jpg">, "image_path": <"file:///tmp/cover-l6_prx37.jpg">}, 4000)

Method Return:
(uint32 38,)

EXPECTED RESULT
A notification

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240704
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.7-1-default (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
I tried both the Flathub package and ran the latest quodlibet.py from git and there was no difference.

I added some print-debugging to the notifcation extension ext/events/notify.py:

print(f"show_notification()") right after def show_notification(self, song):

and 

print(f"{datetime.datetime.now().strftime('%H:%M:%S')} calling Notify()")
print(f"{datetime.datetime.now().strftime('%H:%M:%S')} Notify() called\n")

before and after

iface.Notify("(susssasa{sv}i)",
                "Quod Libet", self.__last_id, image_uri, title, body,
                actions, hints, pconfig.getint("timeout"))

Notify was called every time I tested it, but the notification did not appear every time.

I also tested the notifications by writing a small test script:

# https://pychao.com/2021/03/01/sending-desktop-notification-in-linux-with-python-with-d-bus-directly/

import dbus

item = "org.freedesktop.Notifications"

notify_interface = dbus.Interface(dbus.SessionBus().get_object(item, "/" + item.replace(".", "/")), item)

app_name = "Test"
replaces_id = 0
app_icon = "fingerprint-gui"
summary = "Hello world!"
body = "This is the notification body"
actions = []
hints = {}
expire_timeout = 3000

notify_interface.Notify(app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout)

This notification is always shown, except for when I run the code too quickly in succession, which results in the following exception:

dbus.exceptions.DBusException: org.freedesktop.Notifications.Error.ExcessNotificationGeneration: Created too many similar notifications in quick succession

But since Quod Libet's notifications are all for different songs, this shouldn't be an issue.
Comment 1 TraceyC 2024-09-19 21:16:12 UTC
I can confirm this behavior. 

I noticed that in the setup screen for Song Notifications, there's a test button "Show notification"
The first time I clicked this, I saw the notification. Subsequent clicks produced nothing
A double click produced an error "Connection Error Couldn't connect to notification daemon"

After that, I saw no notifications from this program at all, even after restarting it.
Comment 2 Nate Graham 2024-09-19 22:36:51 UTC
Hmm, this seems like it's probably an app issue. Kai, what do you think?
Comment 3 Nate Graham 2025-03-29 16:23:47 UTC
I can reproduce this. After enabling notifications with the mentioned settings, they appear for a little while and then... just stop appearing.

Example notification that gets sent by the app but not shown by Plasma, as recorded by `dbus-monitor interface=org.freedesktop.Notifications`:


method call time=1743265256.742297 sender=:1.894 -> destination=:1.883 serial=124 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "Quod Libet"
   uint32 8
   string "file:///home/nate/Music/CRONE/Godspeed/cover.jpg"
   string "Crone - The Ptilonist"
   string "6∶51
Godspeed
2018"
   array [
      string "next"
      string "Next"
   ]
   array [
      dict entry(
         string "desktop-entry"
         variant             string "io.github.quodlibet.QuodLibet"
      )
      dict entry(
         string "image_path"
         variant             string "file:///home/nate/Music/CRONE/Godspeed/cover.jpg"
      )
      dict entry(
         string "image-path"
         variant             string "file:///home/nate/Music/CRONE/Godspeed/cover.jpg"
      )
   ]
   int32 4000