Repository navigation
Conversation
The widget opens a menu with the notifications Windows holds, grouped by app, instead of only showing a count. Based on #1070 by Eser Şahiner. - The list comes from UserNotificationListener. Launch, activation type, pictures, attribution and displayTimestamp come from each app's toast history, matched to the list by text since the history has no ids. - Pictures follow the toast schema: appLogoOverride (48 px, round with hint-crop="circle"), hero (364:180) and inline. The image of the Windows 8 ToastImageAndText templates is the logo. Only local files are read (file:///, ms-appx, ms-appdata local), nothing is downloaded. - A click opens protocol links, hands other toasts to the app's toast activator (registry CustomActivator or the Start menu shortcut's ToastActivatorCLSID) out of process, or brings the app forward. - Clear uses ToastNotificationHistory.Clear(appId) per app, then removes what is left with RemoveNotification. Clear(appId) is documented only for apps in the caller's own package but works across apps, and ClearNotifications() fails without package identity. - {count} shows 9+ above nine: Windows counts 21 notifications per app but hands other apps 20, so an exact count can exceed the menu. - App icons fall back to the IconUri an AUMID registers, for senders shell:AppsFolder doesn't list (Firefox, Windows system toasts). - callbacks.on_left now defaults to toggle_menu. Known limitation: while Firefox runs, it ignores an activator call for a notification from its own session and only reacts to the click Windows raises inside its process, so those clicks open nothing. Co-authored-by: Eser Şahiner <7672024+esershnr@users.noreply.github.com>
|
Thanks for this, I've been running it on Windows 11 25H2 and it works well. Two things I noticed with WhatsApp: Order. A WhatsApp message arrived after a Snipping Tool screenshot notification. The Notification Center shows the WhatsApp one at the top, but the YASB menu puts the WhatsApp group below the Snipping Tool group (screenshot below). My branch (#1070) does the same, so it isn't specific to this PR. I haven't found the cause yet. Clicking. Clicking the WhatsApp notification only brings up the WhatsApp home screen, it doesn't open the sender's chat. WhatsApp (the Store/MSIX app) declares its toast activator in its
|
|
The order should be fixed now. As for WhatsApp, I don't have it installed, so I can't test it. But if you have a solution, please send a PR for this branch. |
…ivator fix(notifications): open WhatsApp chats and show sender photos
|
Okay, PR #1194 is merged, so we've now fixed the issue with apps like WhatsApp, and the notification order is also working correctly. As far as I know, Firefox is the only issue left ? |
|
Yes, as far as I can tell Firefox is the only one left. I tested it with https://www.bennish.net/web-notifications.html: with Firefox running, clicking in the YASB menu doesn't reach the page (no click or close event on the site), while clicking the same notification in the Notification Center does. One more Firefox thing: Firefox writes the notification image to |
|
No, we really don't need to copy Firefox images. This browser is basically dead. There are so many bugs with the Media API, and now this... so it's fine. There's one thing I missed when I merged it. Spotify shows the problem: I'll push a small fix that matches the |
Look up the app of each notification once instead of on every refresh.
|
I looked into the Firefox click issue with AI, reading Firefox's source, so take this as a summary rather than something I verified line by line. Short version: it can't really be fixed on our side.
The image is similar: Firefox deletes the temp image file when it closes or drops the notification, by design. So both would need a change in Firefox itself. Fine to leave it as is. |
A package can hold several apps, each with its own activator in the manifest. Use the one under the matching Application Id instead of the first one in the file.
https://searchfox.org/firefox-main/source/toolkit/mozapps/notificationserver/docs/index.md It' a Firefox always does things differently and makes them worse instead of following standards. It's still my default browser, but it's bad, and that's a fact. By the way, when you have time, test all of this again with WhatsApp. I've added some notification ID caching, which saves a lot of time when there are many notifications and makes everything much faster. I've also fixed the AUMID names. |
|
It’s almost certainly part of WhatsApp’s own toast XML, https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-group <binding template="ToastGeneric">
<text>Sender</text>
<text>Last message</text>
<group>
<subgroup>
<text>10 unread messages</text>
</subgroup>
</group>
</binding>we only read the But what I need to know is, does Windows group these into a single notification item, or does it just show the text? Or is this something WhatsApp handles internally, where the app automatically replaces the notification items? |
|
We also missed this https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate, which lets you reply to chats directly from notification items. But let's leave that for now, and I'll implement it later because we'll probably switch to QtQuick very soon, and everything we've built here won't work anymore. Once we switch, we'll move all of this over, and we should be able to handle it better. |



This replaces #1070 with a smaller version built on the same idea, so the notifications widget can show what Windows holds instead of only a count. A lot of it is based on @esershnr's work in #1070, so he is credited as co-author.