Gnome-shell-extension-gsconnect: Notifications are doubled in notification pane

Created on 14 Mar 2020  Â·  21Comments  Â·  Source: GSConnect/gnome-shell-extension-gsconnect

Notifications I receive from GSConnect are listed multiple times (maybe in intervals of the update time) in the gnome notifications pane.

Old messages should be removed or updated, so the notification area doesn't overflow of too much notifications.

I'm using GSConnect on Fedora 31 (Gnome 3.34). I don't know if other distributions suffer from the same bug.

All 21 comments

Can you be more specific about what notifications are duplicated? GSConnect prevents duplicated notifications in two different places already, so unless these are being duplicated by Android I'm not sure how this might happen.

Also, I'm running with the _exact_ same setup (except for a different phone, I assume) and I haven't experienced any of that. I do get a lot of notification buildup in the clock/calendar dropdown, but they're all unique. (My phone is just spammy.)

Not saying my experience makes this report in any way impossible/invalid, of course.

The duplicated notifications include:

  • Email
  • WhatsApp
  • Tasks

The notifications on the Android device (SAmsung A3 2017, LineageOS) are unique. Also, I have connected two devices, also a Nexus 7, which barely gets any notifications. Nevertheless, both devices should not receive Notifications from the PC.

The problem occurs often instantaneous if the pc gets connected to device after a longer time, e.g. after I'm back from work, but also happens if the devices are paired for some time.

Hmm, so these duplicated notifications are coming from two devices? If that's so, they are unique notifications, since one would be coming from each device.

Also note that Android may change the IDs of notifications after a reboot, in which case they will not be treated as unique notifications.

No, the messages are coming from one device. At least this applies to Email and WhatsApp, since I don't have those applications on the tablet.

I will check if the IDs of the Android device. Maybe these are changed by energy saver. The devices are not rebooted before the duplication appears.

The duplicated notifications include:

  • Email
  • WhatsApp
  • Tasks

Hmm. I wonder... except for WhatsApp, those are pretty generic apps. On my phone, I can easily get duplicate Email notifications, for example, if I have my account set up in _both_ Gmail and the stock Email app. (I have all notifications disabled for Email, for that exact reason. Ditto stock Calendar vs. the Google Calendar app.)

But if the dupes are definitely coming from the _same_ app — well, are they perhaps not _really_ duplicates? Like, for instance, GMail will sometimes show me summary notifications of the most recent 3-or-so new email subjects in my Inbox. If I read any _one_ of those messages, it swaps the previous notification out for a new one without that subject in the list. That "rewritten" notification is a completely different one, from GSConnect's perspective.

The other source of not-quite-duplicate "duplicated" notifications I've seen is this:

Because...

  1. I have Media Players sharing turned on in GSConnect
  2. And Media Player Control enabled in the KDE Connect app
  3. And I use plasma-browser-integration to export MPRIS2 media controls from my browser's media players

Every time a YouTube video (for example) plays in my browser, I get a notification on my phone with transport/volume controls. Which is then mirrored _back_ to my desktop. And each individual video generates a new, separate notification.

I eventually disabled "KDE Connect" (ironically), from the list of apps that will have their notifications mirrored to the desktop. (In the "Notification sync" plugin settings in KDE Connect Android.)

I don't know, I'm kind of just throwing things against the wall now, sorry.

The most likely case is that the notification IDs in Android are changing. GSConnect uses GNotification where we set the ID ourselves so repeats are only ever "updated", and when it arrives at the Shell we block repeats from re-showing, so even if it's technically an updated notification we prevent it from grabbing attention.

Like, for instance, GMail will sometimes show me summary notifications of the most recent 3-or-so new email subjects in my Inbox.

Yeah, it's also worth pointing out KDE Connect pulls apart group notifications and sends them as separate notifications. I think it also re-assembles "conversation" messages somehow. Android notifications are pretty convoluted actually.

...then mirrored back to my desktop. And each individual video generates a new, separate notification.

With the right setup (eg. three devices) you can actually get an endless stream of stacking notifications going. I once accidentally used the remote keyboard to control the remote keyboard, which doesn't work out well either :P

Is it possible that you have connected the same device to gsconnect several times?

image

@pflanzenandi No, the devices are paired one time

It seems that reactivating the laptop from sleep, or unlocking causing some duplications.

It seems that reactivating the laptop from sleep, or unlocking causing some duplications.

That could be. It's possible the notification source is not patched before GSConnect connects to the phone and starts receiving notifications. That's pretty hard to fix though, without breaking the rules (that I made up :stuck_out_tongue_closed_eyes:).

Just registered here to tell I have the same problem :)
Especially notifications from WhatsApp are getting out of hand for me.
I will try to tinker with settings (energy saving, security and so on)
Thank you for your work! Love this feature.

I've noticed this problem with WhatsApp too. This morning I had several unread messages on my phone (about 20) and didn't had the time to read them. Over the cause of the morning I got several batches with all my unread messages that were piling up. To me it seemed that on every new message I got, I recieved a notification for all unread messages again (but I might be mistaken, didn't pay close attention). After reading all my messages I still got a few latecomers but it began to calm down.
Is there anything I can do to help you debugging this?

I'm using GSConnect 37 on Ubuntu 20.04
KDE Connect 1.14.2 on Android 9 (Lineage OS)

Edit:
Happend again and I captured a log. I removed the personal data and replaced it by <0000X> - same number means same string. I also did a screenshot: Same color means same string. Also note, that the picture of a contact only shows up once. Maybe this is a clue as well...

Screenshot: https://imgur.com/a/gvjZPsM
Logfile: https://pastebin.com/NckXEVmf

Can you try this zip to see if it fixes the problem (instructions):

[email protected]

No, for me it doesn't solve the problem. But I monitored it a little more closely and can confirm that the problem only happens, if there are multiple unread messages. For a single unread message I get only one notification.

Sorry, I might be misunderstanding. Are you saying notifications with the same content are being duplicated? Or are you saying you're getting a new notification for each unread message?

If the Android app tells us a notification is opened, we show that notification. If it tells us one is closed, we remove it. In addition, if the Android app sends tells us a notification is opened with the same ID as an existing notification we update it. But this is all we can do.

If an app like WhatsApp sends a new notification with a new ID, it is an additional notification, not a replacement. The only way we can tell if a notification is a replacement is if it shares the same ID as an existing notification.

Both :-) Lets say I receive a message from A then I get a notification, as I should. But, if I leave this message unread and later receive a message from B I get a notification for A again and then (sometimes a few minutes delayed) the one for B. And so one - If I were t receive a third message from C I would get A and B again

Okay, I think I might see the problem. Can you try this ZIP?

[email protected]

Still not perfect. Here's what happens with the new zip. Situation: I've unread messages from A and B still on my phone (and already received a notification for them). C writes me a new message:

  • There is still a pop-up notification for messages from A, B and C as before (with A and B being duplicated)
  • But they don't pile up any longer in the list of notifications I get, when clicking on the clock in the top bar on my desktop. Instead this list is cleared and fills up one by one with A, B and C (in that order, the newest being the last one to appear - taking about 30 seconds for each entry to appear).

If the notifications aren't duplicated in the message tray, I'd consider that a fix for this issue.

If the notifications popping up again is something you consider a bug, it's probably best to open a new issue for that, since it will have a different cause.

Thank you for the fix. I'd just like to add, that I'm not sure the new behaviour of the message tray is the optimal solution, because the notifications are readded with mentioned delay. So I don't see the messages from B and C if I open the tray immediately after the notification is displayed. With my example from above:

Starting situation:
A, B and C are in the tray.

D writes a message
Tray is cleared, only A is displayed

~30 seconds later
A and B are displayed

~30 seconds later
A, B and C are displayed

And each "tray update" is accompanied with one pop-up that was already displayed... If it helps you, I will open a new issue for the notifications popping up again, but I still suspect that those two problems are related because the popups appear as the tray is repopulated.

We haven't changed the behaviour of the tray at all, so this would have a different cause.

All we've done is changed the regex to account for weird behaviour by WhatsApp notifications, since they were previously being identified as service notifications.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amivaleo picture amivaleo  Â·  3Comments

daleosm picture daleosm  Â·  6Comments

jorgecodecom picture jorgecodecom  Â·  6Comments

didierga picture didierga  Â·  5Comments

sk0gen picture sk0gen  Â·  4Comments