[snap] Notifications do not show a custom icon

Bug #1903893 reported by Coeur Noir
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Hi,

Notification coming from Chromium web browser ( as a snap ) show generic icon instead of favicon or website icon or any website picture.

For reference
https://forum.snapcraft.io/t/notifications-in-chromium-show-generic-icon/21079
https://github.com/solus-project/budgie-desktop/pull/2000#issuecomment-653833784
https://discourse.ubuntubudgie.org/t/notification-issues/434

It's *not* specific to ( Ubuntu ) Budgie. And to some extent might affect any chromium snap based web browser.

Interesting insight in second link, quoting :

« Chromium based browser notifications pop up with broken icon images. This is due to the fact these browsers prefix the icon name in the notification with "file:///". Furthermore, snap based chromium browsers save the temporary icon in the snap, and don't pass the correct path to Raven. If the icon names start with "file:///", clearing the icon name fixes both of these issues by allowing the browsers to show the correct image (same as Firefox does), and allows the snaps to default to the fallback "mail-unread-symbolic" icon, instead of showing a broken image icon. This fix also should have absolutely no effect on any other notifications. »

Attachment : top right is the actual notification ( with unread mail icon ) it should show :
⋅ ideally, picture from site ( cover art in that case, it's a music streaming site, as done in Firefox in same situation )
⋅ or (fav)icon for the site ( deezer here, which icon is shown a bit above in workspaces applet in top panel )
⋅ or web browser icon ( chromium )

Tags: snap
Revision history for this message
Coeur Noir (coeur-noir) wrote :
Coeur Noir (coeur-noir)
description: updated
description: updated
Revision history for this message
Olivier Tilloy (osomon) wrote :

Chromium uses the Desktop Notifications specification¹ to display notifications².
It sets the app_icon parameter, and according to the specification³, « The "app_icon" parameter and "image-path" hint should be either an URI (file:// is the only URI schema supported right now) or a name in a freedesktop.org-compliant icon theme (not a GTK+ stock ID). »

So a file:// prefix is expected, and correct.
Can you share more details on the problem? Maybe use dbus-monitor to watch the notifications coming in, and share the value of the app_icon parameter?

¹ https://developer.gnome.org/notification-spec
² https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/notifications/notification_platform_bridge_linux.cc;l=582
³ https://developer.gnome.org/notification-spec/#icons-and-images-formats

Changed in chromium-browser (Ubuntu):
status: New → Incomplete
Revision history for this message
Coeur Noir (coeur-noir) wrote :

In other words.

As soon as you use Chromium as a snap, the icons / pictures in notifications are not correct ( usually fallback to a generic one ).

Compare with Chromium on other systems or with other web browser from same website, on the same system.

As mentioned, I'm just a messenger here and quoted the fine people who try to fix this.

Revision history for this message
Sam Lane (samlane00) wrote :

My amateur attempt to clairfy... I believe the issue Coeur Noir is referring to is that Raven / Budgie gets this example as the app_icon:

file:///tmp/.org.chromium.Chromium.beVtiT

But due to it being a snap, the file is actually located at:

/tmp/snap.chromium/tmp/.org.chromium.Chromium.beVtiT

Therefore, Raven (Raven / Budgie Desktop) fails to find the correct file.

Whether this is ultimately a Raven issue or a Chromium issue, I don't know.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Could you give an example or testcase?

Trying on a random website, e.g https://web-push-book.gauntface.com/demos/notification-examples/ the notification displays correctly including icons or image on current chromium snap version

Revision history for this message
Sam Lane (samlane00) wrote :

Using dbus-monitor, and the test site given ( https://web-push-book.gauntface.com/demos/notification-examples/ )

output:
   string "Chromium"
   uint32 0
   string "file:///tmp/.org.chromium.Chromium.kuprxj"
   string "Web Push Book"
   string "web-push-book.gauntface.com

The file does not seem to exist? Instead, I have:
"/tmp/snap.chromium/tmp.org.chromium.Chromium.kuprxj"
created on my system.

Given that this works on other distros, I am guessing the issue must be with Raven/Budgie handling of the noticfications.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Séb, I can confirm what Sam and coeur-noir are seeing. No icon is displayed on notifications with that example website you linked to, and using dbus-monitor I can see that the icons are being saved under the snap's confined TMPDIR, so the path is not visible from the host.

This would probably need a patch to rewrite the path, or save the temporary icon file to a different place that's visible to the host.

Changed in chromium-browser (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → Medium
tags: added: snap
summary: - Notifications from Chromium snap show generic icon
+ [snap] Notifications do not show a custom icon
Revision history for this message
Sam Lane (samlane00) wrote :

I believe the issue with the Budgie desktop/Raven sidebar might also be mitigated if Raven was changed to fall back to using the browser's icon name (google-chrome, chromium, opera, etc). Currently with a snap, it shows a generic alert icon (not the browser's icon). Probably an issue to be raised at Solus. Would be nice ultimately to see the website's notification image, but I understand the sandboxing of a snap makes things trickier.

Revision history for this message
Sam Lane (samlane00) wrote :

As an aside, I notice Brave browser notifications images are visible, using a different path.

image-path: "/run/user/1000/snap.brave/.org.chromium.Chromium.m5lyvv"

Revision history for this message
Sebastien Bacher (seb128) wrote :

Sorry for the confusing, chromium here uses its own notifications and not the system ones which doesn't have the issue described...

Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks Sam, that's a useful point of comparison.

Revision history for this message
Coeur Noir (coeur-noir) wrote :

So the problem here is actually where ( any ) snap will store some files that should be readable by other app's.

No snap can use /tmp by sandboxing design. It's also a problem in Gimp and its plugins for example. Or in Thunderbird when dealing with attached files in mails.

( thumbnails are also a problem in snap as snap can't write into ~/.cache/… )

It seems in Brave case, they found a « better » path ?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Small side comment but Marco did change libnotify to be smart in snaps
https://gitlab.gnome.org/GNOME/libnotify/-/commit/ea61ec43
if chromium doesn't use libnotify then it should probably try to do something similar itself

Revision history for this message
Olivier Tilloy (osomon) wrote :

Chromium doesn't use libnotify, it invokes the org.freedesktop.Notifications D-Bus API directly.

Revision history for this message
Olivier Tilloy (osomon) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.