![]() Registered Member ![]()
|
Hi all,
I'm using a tiny script to show notifications:
It shows a message and a button 'Accept'. But how do I bind some action to button? What is the signature of actions/variants parameters to execute some external program or call another dbus object? Thank you in advance. |
![]() Administrator ![]()
|
I suggest running the program "dbus-monitor" and seeing if KNotify emits any signals or other bits of notable information to inform you of the acceptance.
Note that you will get quite a bit of output, as quite a few KDE services use D-Bus..
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I've solved the issue partly.
According to this documentation (http://www.galago-project.org/specs/not ... /x408.html) when button is clicked org.freedesktop.Notifications.ActionInvoked signal is sent. It contains the id of notification and action_id (matches the sequential order of button that was clicked). It works as expected, but I have no clue how to get the notification id when I send initial call to KNotify. |
![]() Administrator ![]()
|
Isn't "python-notify" enough for your use case? Mind you, I just used it for simple notifiations without actions, so I'm not sure if it is useful for you.
"Violence is the last refuge of the incompetent."
![]() Plasma FAQ maintainer - Plasma programming with Python |
![]() Administrator ![]()
|
The notification ID is likely the integer which is returned to your application when it makes the initial call to KNotify to display the notification.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Unfortunately not, they are different numbers. Any ideas, how to match them? |
![]() Administrator ![]()
|
Are you specifying any value other than "0" for "replaces_id" in your initial call to KNotify?
Please note that if you are relying on the Galago signals, you should use the other parts of the Galago interface as well for consistency.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Hi, i'm new in KDE and this is my first post, so hi to all
![]() I'm using the same script to show notification and i'd like to notify all my cron job, like this:
This is the script to notify each event:
The problem is that some cron job or script are executed as root (sure, they need the privileges) and should be notified to my user session "realnot". What i got is this error:
I found this post http://stackoverflow.com/questions/1517 ... b-on-linux but i don't know if it can help me, if it's safe and how to use in my scripts. Any suggestions? Thanks in advance! |
![]() Administrator ![]()
|
I would recommend you try sourcing the files below ~user/.dbus/session-bus/ before trying to run your script. These should contain all the parameters necessary for root to access your user session bus. You can verify that this has worked by running "qdbus".
You may need to run the following before they will work, after sourcing the files however:
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot], Yahoo [Bot]