artemanufrij / webpin

An elementary OS app
https://artemanufrij.github.io
80 stars 19 forks source link

Custom notification settings #100

Open sempasha opened 5 years ago

sempasha commented 5 years ago

Since webapp .desktop file contains X-GNOME-UsesNotifications=true you can set custom notification settings for each web application. image But it doesn't work because of mismatch between notification desktop-entry tag and application .desktop file name.

My case:

  1. I have a Google Play Music application
  2. .desktop file at ~/.local/share/applications/ has name Google Play Music-webpin.desktop
  3. I have notifications configuration for this app to show only bubbles without sound
  4. Capturing application's notifications with dbus-monitor --session shows, that notification, created by application, looks like
    method call time=1555098482.534859 sender=:1.430 -> destination=org.freedesktop.Notifications serial=21 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
    string ""
    uint32 0
    string ""
    string "War Pigs"
    string "Black Sabbath - Paranoid"
    array [
      string "app.open-web-app('https://play.google.com/music/listen')"
      string "Open Google Play Music"
    ]
    array [
      dict entry(
         string "desktop-entry"
         variant             string "a4af67a.artemanufrij.webpin"
      )
      dict entry(
         string "urgency"
         variant             byte 1
      )
      dict entry(
         string "image-path"
         variant             string "/home/sempasha/.cache/com.github.artemanufrij.webpin/Google Play Music"
      )
    ]
    int32 -1
  5. When notification captured by pantheon notifications widget widget tries to find application info by searching .desktop file. For search it uses desktop-entry tag, so search always failed, because .desktop file name Google Play Music-webpin.desktop is not match desktop-entry tag value a4af67a.artemanufrij.webpin
  6. Due to notification widget can't find app info it uses default notifications settings

Renaming .desktop file to a4af67a.artemanufrij.webpin.desktop solves the issue.

sempasha commented 3 years ago

At GNOME Goal: Notification Sources said

desktop_id should be the basename of the applications desktop file. E.g. rhythmbox installs /usr/share/applications/rhythmbox.desktop, so the desktop_id should be "rhythmbox".

So pantheon notifications widged do its job exactly as it should.

In my view gnome goal sheets miss one thing - <desktop-entry>.desktop should allow not only to make a statement, that application supports notifications, but also to specify identifier which application will use for notifications.

Nonetheless, for now the only way to fix notifications is to specify <desktop-entry>.desktop file name in way, when <desktop-entry> is same as desktop-entry property of notification.