elementary / notifications

Gtk Notifications Server
https://elementary.io
GNU General Public License v3.0
38 stars 6 forks source link

Icon not set when notified from background process #117

Closed marbetschar closed 3 years ago

marbetschar commented 3 years ago

Prerequisites

Describe the bug

The notification server does not use the application icon when the notification is sent from a daemon process:

Screenshot from 2021-05-04 23-29-30

Expected behavior

The notification server should use the Icon defined in the *.desktop file of the daemon application.

Possible root cause

The deamon is a GLib.Application with a *.desktop file stored in /etc/xdg/autostart/com.github.marbetschar.time-limit-daemon.desktop. It contains the following configuration:

[Desktop Entry]
Name=Time Limit Daemon
Comment=Notify when time is up
Exec=/usr/libexec/com.github.marbetschar.time-limit-daemon
Icon=com.github.marbetschar.time-limit
Terminal=false
Type=Application
Categories=System;
OnlyShowIn=Pantheon;
NoDisplay=true
X-GNOME-AutoRestart=true
X-GNOME-Autostart-Phase=Applications
X-GNOME-UsesNotifications=true

From what I understood, the notification server uses the DesktopAppInfo to retrieve the app_icon.

Furthermore the DesktopAppInfo itself uses the app_id to retrieve the desktop configuration file. And - according to the docs - reads the path information from the XDG_DATA_HOME and XDG_DATA_DIRS environment variables:

GIO is looking for a desktop file with this name in the applications subdirectories of the XDG data directories (i.e. the directories specified in the XDG_DATA_HOME and XDG_DATA_DIRS environment variables). GIO also supports the prefix-to-subdirectory mapping that is described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will match /usr/share/applications/kde/foo.desktop).

However, If I print those environment variables the /etc/xdg/autostart directory does not appear. If I'm on the right track, this causes the notification icon of daemon apps to be never shown:

$ echo $XDG_DATA_HOME

$ echo $XDG_DATA_DIRS
/usr/share/gnome:/usr/share/pantheon:/home/$USER/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/

Platform Information

elementary OS 6 Odin Daily.