PDA

View Full Version : Dbus and interaction with plugins help


DocHoliday
March 10th, 2007, 07:45 PM
Ok this is driving me nuts. How do I initiate the snow plugin and set the number of snow and speed at the same time?

I have dbus working and can initiate the snow via: dsend.sh snow Initiate however I want to set the number of snow flakes and the speed.

Help would be very much appreciated.

mikedee
March 10th, 2007, 07:58 PM
Dont use dsend.sh, its outdated and unsupported.

The instructions for all the dbus commands are in the dbus.c file, examples for set is here (set is the function you need to set an option value)

The active plugins example can be modified for the snow textures and the command option can be modified to set any non list value. int32 and double are the dbus datatypes (I think)

/*
* 'Set' can be used to change any existing option. Argument
* should be the new value for the option.
*
* Example (will set command0 option to firefox):
*
* dbus-send --type=method_call --dest=org.freedesktop.compiz \
* /org/freedesktop/compiz/core/allscreens/command0 \
* org.freedesktop.compiz.set \
* string:'firefox'
*
* List and action options can be changed using more than one
* argument.
*
* Example (will set active_plugins option to
* [dbus,decoration,place]):
*
* dbus-send --type=method_call --dest=org.freedesktop.compiz \
* /org/freedesktop/compiz/core/allscreens/active_plugins \
* org.freedesktop.compiz.set \
* array:string:'dbus','decoration','place'
*
* Example (will set run_command0 option to trigger on key
* binding <Control><Alt>Return and not trigger on any button
* bindings, screen edges or bell notifications):
*
* dbus-send --type=method_call --dest=org.freedesktop.compiz \
* /org/freedesktop/compiz/core/allscreens/run_command0 \
* org.freedesktop.compiz.set \
* string:'<Control><Alt>Return' \
* string:'Disabled' \
* boolean:'false' \
* string:'' \
* int32:'0'
*/

DocHoliday
March 10th, 2007, 10:36 PM
Thanks for the tip, but I still can't work out how to do the snow thing. I'm a complete beginner so as you can imagine having some difficulty learning.

Is there a guide some where I can follow?

mikedee
March 11th, 2007, 04:07 PM
Err, there is no documentation. What I copied and pasted from the code is basically it.

What exactly were you trying to do and in which language? What errors are you getting?

RYX
March 11th, 2007, 07:51 PM
You can do this very easily using python. I have written a simple example (http://forum.go-compiz.org/viewtopic.php?p=4929#4929) that shows how to easily access options/actions in plugins and core ...

It is a good base for starting to play around with compiz and dbus and surely better than dbus-send.

:)

DocHoliday
March 14th, 2007, 02:02 PM
Thanks guys, I'm a beginner to programming so I've bought a book and borrowed some from the library. Hopefully I'll be able to code something more than just Hello World :P