Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable notification badges #1803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ibauersachs
Copy link

I'm noticing the missing notification counter badges mentioned in #1695 as well. This PR is based on the patch from @vaskion, but omits the animation changes.

@vaskion
Copy link

vaskion commented Dec 1, 2022

Please keep in mind that in the latest Ubuntu 22.10 for some applications the notifications (and the badges of course) will not go away automatically when you read them/open the app which posted them. I played around with my mods but was not able to fix it. I disabled the DashToPanel extension and it was still happening. So, I think this might be some issue with the OS itself as for these apps the notifications still stay in the system tray even you have read them until you click on the clock and then select 'Clear'. This is happening with Teams for me. Google Chrome and its chat app do not have this issue.

@xalt7x
Copy link
Contributor

xalt7x commented Dec 4, 2022

@vaskion , @ibauersachs
Thanks to the RocketBar extension I've managed to filter-out notification badges that won't go away until you clear them from the Message Tray (e.g. file operations with Nautilus), and some rather distracting ones (e.g. "Window is ready"). Also hopefully found a correct way to detect appropriate application by ID (rather than name/title)
I've tested some applications which currently lack UnityAPI support (Hamsket/Rambox, Google Chrome, Firefox, Thunderbird) and all of them still get badges.

--- a/progress.js
+++ b/progress.js
@@ -391,8 +391,7 @@
             let unreadCount = 0;
             for (let i = 0; i < items.length; i++) {
                 let item = items[i];
-                // FIXME - Check if these 12 symbols are enough
-                if (this._source.app.get_name().includes(item.title.substring(0, 12))) {
+                if (this._source.app.id == item.app.get_id() && item instanceof imports.ui.notificationDaemon.FdoNotificationDaemonSource) {
                     unreadCount += item.notifications.length;
                 }
             }

@vaskion
Copy link

vaskion commented Dec 5, 2022

Definitely not working on my end.

@vaskion , @ibauersachs Thanks to the RocketBar extension I've managed to filter-out notification badges that won't go away until you clear corresponding notifications from the Message Tray (e.g. file operations with Nautilus), that also took away some rather distracting ones (e.g. "Window is ready"). And hopefully I've found a correct way to detect appropriate application by ID (rather than name/title) Tested some applications which currently lack UnityAPI support (Hamsket/Rambox, Google Chrome, Firefox, Thunderbird) and all of them still receive badges.

--- a/progress.js
+++ b/progress.js
@@ -391,8 +391,7 @@
             let unreadCount = 0;
             for (let i = 0; i < items.length; i++) {
                 let item = items[i];
-                // FIXME - Check if these 12 symbols are enough
-                if (this._source.app.get_name().includes(item.title.substring(0, 12))) {
+                if (this._source.app.id == item.app.get_id() && item instanceof imports.ui.notificationDaemon.FdoNotificationDaemonSource) {
                     unreadCount += item.notifications.length;
                 }
             }

Thanks a lot for looking into this! Unfortunately this mod does not work on my end. I am still getting "Open is ready" notifications from VSCode. Teams notifications are still persistent in the system tray and the app badges stay on the panel until I hit clear in the system tray. Extremely annoying... Seems like an OS issue to me.

@xalt7x
Copy link
Contributor

xalt7x commented Dec 5, 2022

I need to register Teams account for a test. On Ubuntu 22.04 for me "Window is ready" wasn't counted in any app yet (not sure how to trigger it with VSCodium though). Today few times had a problem with "Google Chat" PWA. Notification wasn't present on a message tray but badge still didn't go away until I cleared all notifications. Also once Google Chat PWA didn't receive badge until I deleted one of the notifications. Maybe some events got skipped, still testing...
Could you try RocketBar extension? You'll need to select "keep original gnome-shell top panel" from "Dash-to-Panel" options or disable "Dash-to-Panel" extension).
Also I'm curious to test with your progress.js (would probably install Ubuntu 22.10 on VM just to make sure).

@ibauersachs
Copy link
Author

Note that the Teams app is deprecated, the "replacement" is just Edge with Teams as a PWA. Thus any website or PWA from Chrome/Chromium/Edge should expose the same behavior.

@xalt7x
Copy link
Contributor

xalt7x commented Dec 5, 2022

For some reason
this._source.app.id == item.app.get_id()
stopped working for me so I've edited my post with a "filtering" patch leaving only
item instanceof imports.ui.notificationDaemon.FdoNotificationDaemonSource as additional condition.

@vaskion
Copy link

vaskion commented Dec 5, 2022

I need to register Teams account for a test. On Ubuntu 22.04 for me "Window is ready" wasn't counted in any app yet (not sure how to trigger it with VSCodium though). Today few times had a problem with "Google Chat" PWA. Notification wasn't present on a message tray but badge still didn't go away until I cleared all notifications. Also once Google Chat PWA didn't receive badge until I deleted one of the notifications. Maybe some events got skipped, still testing... Could you try RocketBar extension? You'll need to select "keep original gnome-shell top panel" from "Dash-to-Panel" options or disable "Dash-to-Panel" extension). Also I'm curious to test with your progress.js (would probably install Ubuntu 22.10 on VM just to make sure).

Yeah, try the 22.10. This happened after I installed the update. Maybe it is because I updated and did not do a clean install. Before that I have no issue with my original mod - it was working perfectly! I had to install the update though because I had some issues with the network which are now solved. So, it seems they fix something but break something else.

P.S. I am experiencing some other issues with this update as well - some buttons and menus are not rendered correctly and when I go with the mouse pointer over some items they got repainted and overlap with the others. Extremely ugly... This is the most immature and buggy OS I have ever seen so far...

@Yushi5058
Copy link

I'm waiting for this feature ..

@AndyNetDuma
Copy link

Can confirm this works well with 22.04. Can't comment on 22.10
Would be nice to get this merged so I don't have to manually install it from the branch

@kaimast
Copy link

kaimast commented Jul 19, 2023

Could you rebase this branch? Looks like it is over 100 commits behind upstream.

@ibauersachs
Copy link
Author

I'll have a look. But I need to address @xalt7x comment. As it is now, it either doesn't work or shows the badge on the wrong app (e.g. if running Outlook and Teams as Chrome/Edge-based PWA, it may show the notification on any running Chrome/Edge app in the panel).

@xalt7x
Copy link
Contributor

xalt7x commented Jul 30, 2023

But I need to address @xalt7x comment.

TLDR: Developers might figure out some workaround but that's probably more of an upstream Chromium issue.


  1. We've discussed this in RocketBar issue #26 and the extension author assumed that it's a Chrome issue.
  2. With Dash to Dock v79 and newer (which lately got such notification badges) this issue is reproducible as well.
  3. Google Chrome Flatpak had somewhat similar issue and now it uses Flextop wrapper to separate PWA launchers from the main Google Chrome (unfortunately this also breaks notification badges).

@ibauersachs ibauersachs force-pushed the notification-badges branch from 434cc70 to f68b2af Compare August 5, 2023 18:08
@ibauersachs
Copy link
Author

@kaimast and @xalt7x

I've updated the implementation to

  • only trigger once for each notification
  • properly compare the app id
  • and to follow the Gnome policy, which is per app, if notifications should be shown or not

The issue that with Chrome/Edge is that the first launched instance is always then one that sends the notifications. The app-id of the normal browser is e.g. microsoft-edge.desktop and for a PWA it's msedge-faolnafnngnfdaknnbpnkhgohbobgegn-Default.desktop, but that's not reflected in the notification. Whatever handles the notifications thus cannot distinguish between a regular browser window or a PWA.

@vaskion
Copy link

vaskion commented Aug 8, 2023

@ibauersachs Thanks a lot for looking into this!
I tested your changes and they work fine except for MS Teams. For some reason on Ubuntu 22.04 it does not clear the badge and the notification as well until you click on the clock and then the "Clear" button to remove all notifications. So, I am reverting back to stock variant. Unfortunately, these changes are not usable for me in their current form until MS Teams issue is fixed...

@ibauersachs
Copy link
Author

@vaskion Is that the (deprecated) Teams app or via PWA?

@vaskion
Copy link

vaskion commented Aug 8, 2023

@ibauersachs I am not sure what you mean by PWA, but I am using a separate application I installed more than an year ago and not the web application inside Chrome or other browser. So, I guess it would be the deprecated thingy.

@xalt7x
Copy link
Contributor

xalt7x commented Aug 8, 2023

@vaskion
Maybe you have issue similar to this?
ferdium/ferdium-app#1142

@vaskion
Copy link

vaskion commented Aug 8, 2023

@xalt7x Yeah, very much seems like this one but it happens only with MS Teams so far. Anyways, I have given up from making the badge thing work on Ubuntu...

I think I read somewhere that on Ubuntu 24.something the badges are already integrated in the OS itself but they ruined something else I use. Seems like one step forward, two steps back...

@brunologitravel
Copy link

is working in this one: https://github.com/micheleg/dash-to-dock

@NickBelhomme
Copy link

I tried this on the latest installed version on GNOME 46.
Does not work for me.
I do not see the notification indicator on the discord app.
It does show in the appIndicator extension...

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants