How to set symbolic icon to notification?

How can I put a small symbolic icon in front of the app name in notifications?

Hi,

Here is how I do in Python:

notif = Gio.Notification()
notif.set_title(title)
notif.set_body(body)
notif.set_icon(Gio.ThemedIcon.new_with_default_fallbacks("alarm-symbolic"))
app.send_notification(n_id, notif)

Thanks, but I’m about this icon

image

The symbolic icon displayed in a notification sent by your application is read from a specific path in your system, which is at /usr/local/share/icons/hicolor/scalable/apps but this can vary where you install your application’s icons (usually done through the Meson build system). So, if your application ID is, for example, “com.example.App”, your symbolic icon should be installed as /usr/local/share/icons/hicolor/scalable/apps/com.example.App-symbolic.svg (Note that the SVG file is formatted as @APP_ID@-symbolic.svg.)

I actually have not worked with notifications before, I am new as well, but this is the standard for storing your application’s icons and I believe the shell looks here when it wants to display your application’s symbolic icon.

That’s the application icon as defined in the desktop file.

You need to install your application in order for the shell to associate its application id with the desktop file.

For more information:

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.