Git Product home page Git Product logo

Comments (12)

mkiol avatar mkiol commented on August 26, 2024

Thanks for sharing your findings. I've just committed the change (479f77f).

It's worth mentioning, that URI form works only when version of notification daemon is 1.2.

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

Also, I believe you should pass it as "image-path" and not icon, and the icon should probably be "firefox".

I'm using libnotify and libnotify API is quite limited. Look at this function. There is only one icon param :-/.

from gnotifier.

sardemff7 avatar sardemff7 commented on August 26, 2024

First, thanks for the fix!
Then, sorry that I overlooked your code a bit.

In that case, you should use notify_notification_set_image_from_pixbuf() if possible. libnotify already pulls gdk-pixbuf as a dependency so it is merely a matter of accessing the API. This will use the image-data/image_data/icon_data hint, depending on the specification version.

Wait, I just remembered, you can add the hint directly if you want, using notify_notification_set_hint(), it makes less API to use, since creating the GVariant will require only one function g_variant_new_string() and even better, they use floating references (so you do not have to worry about freeing it). This one works on 1.2 only.

Again, if you want to point be at the relevant part of the code, I can provide a patch.

Side note: a server not using the 1.2 version of the spec should probably die quickly. Do you know any?
A new specification is implemented in GTK+ and org.freedesktop.Notifications is being deprecated already. (At least for GNOME, not sure KDE ever really relied on it anyway, they have an internal one IIRC.)

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

Thank you for clarification. Now I see that libnotify has everything what it's needed! Apparently I was blind earlier.

Yes, I would be very grateful if you could provide a patch. Feel free to change whatever you think is needed. IMHO, the best way would be to modify the notifyWithActions fun from linux.js.

Regarding servers using spec below version 1.2. Probably I wouldn't noticed it, but my distro (Opensuse 13.1 with KDE) uses 1.1. So, there is at least one that is alive :-)

from gnotifier.

sardemff7 avatar sardemff7 commented on August 26, 2024

I just read the 1.1 specification and image_path (deprecated hint now renamed image-path) and app_icon should already be file:// URIs according to it.

What is your exact server implementation, maybe we can fix it?

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

It's notification-daemon 0.7.6-4.1.3. Source on build.opensuse.org

Libnotify's notify_get_server_info returns this:

  • name: Plasma
  • vendor: KDE
  • version: 1.0
  • spec_version: 1.1

from gnotifier.

sardemff7 avatar sardemff7 commented on August 26, 2024

This is strange. As visible here They were already using GFile with g_file_new_for_commandline_arg, so it should handle (for absolute paths) both file:// URI and straight paths.

Can you test this simple program just to be sure:

/*
 * Compile with: gcc -o test test.c $(pkg-config --cflags --libs gio-2.0)
 */

#include <glib.h>
#include <gio/gio.h>

int
main(int argc, char *argv[])
{
    if ( argc < 2 )
        return 1;

    GFile *file;
    file = g_file_new_for_commandline_arg(argv[1]);
    g_print("%s", g_file_get_path(file));

    return 0;
}

Thanks for investigating.

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

Will test it, but tomorow.

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

It works as expected. For example it converts file:///tmp/test to /tmp/test.

from gnotifier.

mkiol avatar mkiol commented on August 26, 2024

Find below dbus-monitor log and screenshot of my KDE notification message. File URI is passed to notification daemon, and the result is as you see - icon is invalid.

method call sender=:1.950 -> dest=:1.18 serial=16 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "Firefox"
   uint32 0
   string "file:///tmp/gnotifier-ydp0GB"
   string "Notification #1"
   string "This is the text body of the notification. 
Pretty cool, huh?"
   array [
      string "gnotifier_140610956506880_0"
      string "Otwórz"
   ]
   array [
   ]
   int32 -1
method return sender=:1.18 -> dest=:1.950 reply_serial=16
   uint32 50

img13

from gnotifier.

sardemff7 avatar sardemff7 commented on August 26, 2024

I think you are not using notification-daemon but something integrated to KDE.
I am trying to identify which KDE component is providing notifications, it seems it is a Plasma applet, but it is quite hard to locate the exact code.

from gnotifier.

sardemff7 avatar sardemff7 commented on August 26, 2024

Ok, I found the code!
You can see line 132 that is is checking for the file: scheme. But this code is not used for the app_icon param, which leads to your error. Used with the image_path hint (now image-path) it should work perfectly.

Your version is 2 years old, so I think we cannot patch it, but the code is still in use Plasma! There may be hope to fix that code and port it to 1.2…

Edit: BTW, the code in Plasma is the same, so it does not check for file:// in app_icon, and your code is currently “broken” then. I will try to fix #69 quickly, then everyone will be fine.

from gnotifier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.