Bug 503838 - Not emitting KNotification::closed on timeout with KNotification::CloseOnTimeout flag OR need a way to dismiss a notification and keep it in history
Summary: Not emitting KNotification::closed on timeout with KNotification::CloseOnTime...
Status: REPORTED
Alias: None
Product: frameworks-knotifications
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-06 11:52 UTC by Noah Davis
Modified: 2025-05-14 06:27 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Noah Davis 2025-05-06 11:52:23 UTC
SUMMARY
I'm pretty sure KNotification::closed should be emitted when a notification times out with the KNotification::CloseOnTimeout flag. However, I also noticed that calling KNotification::close removes a notification from notification history, which is not something I want for my usecase. I'm not sure if there's a bug or if this needs to be a feature request. Spectacle needs a way to let a notification with a URL pointing to a file remain on the screen before it has expired and in history without keeping Spectacle alive.

STEPS TO REPRODUCE
1. Create a KNotification object with the KNotification::CloseOnTimeout flag.
2. Send the notification while the GUI isn't visible and a QEventLoopLocker is active to keep the application alive.
3. Connect KNotification::closed to a lambda that deletes the event loop locker when the notification is closed.

OBSERVED RESULT
The notification appears, expires and is sent to history, but KNotification::closed is never emitted. If I use a QTimer to call KNotification::close, the notification disappears from notification history, which is undesirable for my usecase.

EXPECTED RESULT
It should be possible to separate the notification being visible on the screen or in history from the lifetime of the sending app.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20250502
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.0
Kernel Version: 6.14.4-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 32 GiB of RAM (30.8 GiB usable)
Graphics Processor: AMD Radeon Graphics
Manufacturer: Eluktronics
Product Name: THINN-15
Comment 1 Kai Uwe Broulik 2025-05-14 06:27:00 UTC
You can't have both. Either we send a close or we don't. The spec doesn't work that way. 

But exactly this bug is why i have been against breaking the spec in the way we did.