[pynotify] Replace notifications created by another process

View: New views
4 Messages — Rating Filter:   Alert me  

[pynotify] Replace notifications created by another process

by Ismael Barros² :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I'm working on a program in Python that can be executed by a
daemon several times in a second, producing a notification in each
execution.

Now, each notification is overlapped to the older one, but I would
like to make each notification update the older one instead, following
the behaviour obtained by update on pynotify, or by the replaces_id
fieldd in dcop. Would it be possible to make this work through
different program instances? For example, a dcop call that detects if
there is any notification being shown, get its header to see if it's
mine, get its body and concatenate the new information to the older
one. Or maybe an undocumented pynotify function.

Greetings

--
...yet even then, we ran like the wind, whilst our laughter echoed,
under cerulean skies...
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: [pynotify] Replace notifications created by another process

by Christian Hammond-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

There's nothing in place for getting a notification's ID through either d-bus or pynotify. You would have to somehow share the ID between instances of your program in order to replace the notification. It's such a rare usecase that I don't know that it should go into the notification spec (plus it's prone to abuse and to problems, such as if two notifications shared the same header text).

What's the goal of the daemon and the python process? Can the process somehow use the daemon to grab a notification ID for use, or go through the daemon to emit notifications (allowing the daemon to track the ID)?

Christian

On Dec 2, 2007 4:23 AM, RazZziel <razielmine@...> wrote:
Hi, I'm working on a program in Python that can be executed by a
daemon several times in a second, producing a notification in each
execution.

Now, each notification is overlapped to the older one, but I would
like to make each notification update the older one instead, following
the behaviour obtained by update on pynotify, or by the replaces_id
fieldd in dcop. Would it be possible to make this work through
different program instances? For example, a dcop call that detects if
there is any notification being shown, get its header to see if it's
mine, get its body and concatenate the new information to the older
one. Or maybe an undocumented pynotify function.

Greetings

--
...yet even then, we ran like the wind, whilst our laughter echoed,
under cerulean skies...
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel



--
Christian Hammond - chipx86@...
VMware, Inc.
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: [pynotify] Replace notifications created by another process

by Holger Berndt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On So, 02.12.2007 12:41, Christian Hammond wrote:

>It's such a rare
>usecase that I don't know that it should go into the notification spec

Sorry to hijack the thread, but what's the state of the spec anyways?

As far as I remember, it was the goal to have it be a freedesktop.org
spec.. I see the D-Bus service is called
"org.freedesktop.Notifications.service", but the freedesktop.org page
doesn't seem to mention the spec (which is still hosted on the galago
site). What's the status?

Now that KDE is changing to D-Bus with version 4, the biggest
blocker should be solved, shouldn't it? How's the KNotify support for
the spec (or rather, how is it planned for KDE4)? Anybody got any
information?

Holger
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: [pynotify] Replace notifications created by another process

by Ismael Barros² :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, thank you for the support :)

I'm working in a daemon for klik (http://klik.atekon.de/) that watches
(with inotify) a "Applications folder" for new applications, and when
a new package arrives, it executes a python script (almost all the
codebase of klik was done in python when started the daemon) to
register the new application in the menu. When a package is
registered, a notification is displaied.

The problem is that, even if inotify is able to register groups of
changes, when installing more than one applications to the
"Applications folder" at once, inotify is not able to send them all to
the python script. It sends them in packs of 3, 2 or 1 applications.
The python script displays a notification for each call, so it will
display one notification for each group of 3, 2 or 1 applications,
which is kinda ugly if we are registering around 10 applications in
less than a second. Not a big deal, but it would be nice to be able to
get really clean notifications. My goal was to be able to update the
previous notification, adding the last menu entries.

However, if getting the ID of an existing notification is not already
possible, I suppose I could workaround this in other way, for example:

- Move the daemon to the python side of the application, but I was
doing it in C++ to make it as lightweight as possible. I tried to
write it in python, but the memory footprint was some magnitudes
bigger.
- Call the python script disabling the notifications and implementing
them in the C++ side, so I'd be able to save the last notification
object to "update" the popup. This solution would add another
dependency to the daemon (in the python script we can simply "do
nothing" if the pynotify library doesn't exist), and it would be much
harder to track the names and icons from inside each application
package (it's already implemented in python)
- ...or maybe, in the python side, I can use dbus instead of pynotify
(if only dbus is able to address a notification by its ID), save the
notification ID and its body to a temporal file, and let the next
instance of the python script try to reuse the previoud notification.
However, how could I either remove the file when the notification
expires, or test if a notification with an specific ID is being
displaied, to avoid reusing a non-existant notification?

Greetings

On Dec 2, 2007 10:41 PM, Christian Hammond <chipx86@...> wrote:

> Hi.
>
> There's nothing in place for getting a notification's ID through either
> d-bus or pynotify. You would have to somehow share the ID between instances
> of your program in order to replace the notification. It's such a rare
> usecase that I don't know that it should go into the notification spec (plus
> it's prone to abuse and to problems, such as if two notifications shared the
> same header text).
>
> What's the goal of the daemon and the python process? Can the process
> somehow use the daemon to grab a notification ID for use, or go through the
> daemon to emit notifications (allowing the daemon to track the ID)?
>
> Christian
>
>
>
> On Dec 2, 2007 4:23 AM, RazZziel <razielmine@...> wrote:
> >
> >
> >
> > Hi, I'm working on a program in Python that can be executed by a
> > daemon several times in a second, producing a notification in each
> > execution.
> >
> > Now, each notification is overlapped to the older one, but I would
> > like to make each notification update the older one instead, following
> > the behaviour obtained by update on pynotify, or by the replaces_id
> > fieldd in dcop. Would it be possible to make this work through
> > different program instances? For example, a dcop call that detects if
> > there is any notification being shown, get its header to see if it's
> > mine, get its body and concatenate the new information to the older
> > one. Or maybe an undocumented pynotify function.
> >
> > Greetings
> >
> >
> >
> >
> > --
> > ...yet even then, we ran like the wind, whilst our laughter echoed,
> > under cerulean skies...
> > _______________________________________________
> > galago-devel mailing list
> > galago-devel@...
> > http://lists.freedesktop.org/mailman/listinfo/galago-devel
> >
>
>
>
> --
> Christian Hammond - chipx86@...
> VMware, Inc.



--
...yet even then, we ran like the wind, whilst our laughter echoed,
under cerulean skies...
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel