![]() Registered Member ![]()
|
Hello!
I have been googling whole day for a solution - but did not find anyone that managed to solve it already. I am creating a bash script, and I would like it to show notifications using KNotify4. The problem is that all my attempts to control it using DBus are failing.
If I try to write arguments for all properties I will get this error message:
If I use QDbusViewer to launch the method everything works fine, and I do not need to pass all arguments to the method either. Any clues? I am using KDE 4.2 svn trunk from yesterday
Last edited by Znurre on Sun Jan 04, 2009 4:19 pm, edited 1 time in total.
|
![]() Administrator ![]()
|
Unlike in the C++ API, qdbus wants you to use spaces to seperate arguments. You could try without the commas. I think it also demands all of the available variables be supplied ( try setting them to 0 if you don't want to provide them )
Last edited by bcooksley on Mon Jan 05, 2009 6:28 am, edited 1 time in total.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks alot for taking your time, however it still does not work.
The qdbus command tells me this is how to invoke the method:
But how can I create a QVariantMap or a QStringList using bash? Or even simulate this.... Maybe it is not possible to call Notify using qdbus.
Last edited by Znurre on Mon Jan 05, 2009 11:26 am, edited 1 time in total.
|
![]() Mentor ![]()
|
I took a look into the sourcecode of qdbus and it seems that you cannot pass a QVariantMap. So perhaps you have to write a little wrapper program in C++ or python, which receives the parameters you need and call Notify via dbus.
Last edited by msoeken on Fri Jan 16, 2009 6:49 am, edited 1 time in total.
![]() [size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size] |
![]() Registered Member ![]()
|
Thanks for looking into it. I will write a wrapper in C++ but perhaps something similar should be shipped by default with KDE4, kinda like notify-send for libnotify? |
![]() Mentor ![]()
|
If you write your wrapper for common use and if it is not too specific to a concrete task, you can commit it to svn (in /trunk/playground). This could be the first version of a notify-send then.
Last edited by msoeken on Fri Jan 16, 2009 6:49 am, edited 1 time in total.
![]() [size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size] |
![]() KDE Developer ![]()
|
Another option might be to use kdialog's passivepopup option.
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
If you do write a c++ wrapper suitable for common use and are willing to share it I would love a copy. I lack the knowledge to write such a thing myself.
I have a couple of bash scripts which notify users of various things (like having gone over their quota on an NFS mounted home dir) and currently under KDE 3 I'm using kdialog which works but is a bit crude. I was really hoping that in KDE 4.2+ I would be able to make use of the system tray notifications. I'm very disappointed to find out that it's not possible. So close, yet so far... I'd also be grateful if someone could point me to somewhere which explains what all the options available on dbus calls such as org.kde.VisualNotifications /Notify actually do. Stuff like body (Qstring) and Summary (QString) are easy to figure out, but what the heck are the actions and hints values for? Whatever I enter in qdbusviewer gets ignored and I've not found any enlightenment via Google. |
![]() Registered Member ![]()
|
Actions, no idea (haven't been able to figure out where this is actually used, the code is very distributed over SVN). Hints is unused though, says the source. Kinda mean that just this parameter prevents the qdbus invocation. |
![]() Registered Member ![]()
|
Ok, actions comes from the fd.o galago (notification) specification and enables buttons to appear on the spec as far as I can see. Nothing that one would need for plain "passive popup" purposes. |
![]() Registered Member ![]()
|
I changed kdialog so that a standard call of
(title and timeout are optional) makes use of those VisualNotifications if they are available. The release team allowed me to backport it to 4.2 too, so there you go.
Last edited by jpetso on Mon Jan 19, 2009 12:20 am, edited 1 time in total.
|
![]() Registered Member ![]()
|
That is very neat. Not as good as being able to do what I and the OP wanted to, but still a welcome feature. Good work! |
![]() Registered Member ![]()
|
any notify-send in the works? kdialog doesn't set icon
![]() |
![]() Registered Member ![]()
|
I needed such a script. Wasn't that difficult to write it in python. Its not complete but I think its not very hard to modify it for your own needs:
Murphy's Law is recursive. Washing your car to make it rain doesn't work.
|
![]() Registered Member ![]()
|
To dig up an old thread, I have been looking for a such a script, found the one in the post above, did some Googling about Python, and modified it to this:
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]