HomeDocumentationFAQCommunity Log in / create account
compiz.org 

From Compiz

Here is a quick overview of the api so far, dbus is an oo style binding so there are objects with sub objects and methods on those objects. The object is represented by an object path like this:

/org/freedesktop/compiz/rotate/screen0/timestep

This example represents an option object. Here is the breakdown of each object and the methods available.

Contents

Compiz Object

Path /org/freedesktop/compiz

Methods

getDisplayData ()  
returns a dictionary with all the relavent information about the display (there is not a lot that seems useful).
getScreenData (int screen_id) 
returns a dictionary with the screen information.
getWindowData (int window_id) 
supply with a window id and it will return a dictionary with all the relavent data.
getWindowList (int screen_id) 
returns a list of all the windows for a given screen id. This is the same as the windows that appear in the switcher so there shouldnt be any non user windows there.

Screen/Display Object

This represents a collection of screen or display options for a particular plugin.

Path /org/freedesktop/compiz/plugin/[screen0|allscreens]

Methods

getOptions () 
will return an array of all the options for that screen/display.

Option Object

This represents an individual option in gconf. This allows you to set and get values, plus allows you to activate and terminate any action options.

Path /org/freedesktop/compiz/plugin/[screen0|allscreens]/option_name

Methods

getValue () 
Gets the value for the option.
setValue (variant value) 
Sets the option value
getMetadata () 
Gets the information about the option, description type etc.
get[Int|Float|String]Rest 
These methods get the restrictions for int, float and string options.
activate (int root_id) 
if the option is an action then you can activate it as if the user pressed the buttons with this method, it normally takes the root_id, but it can also take other parameters, depending on the option. The root_id can be found out by querying the screen object.

In addition to methods on objects, the dbus plugin also sends different signals on certain events. At the moment the list of events is restricted but David will shortly add more. The events that are forwarded as signals are:

  • windowMoveNotify
  • windowGrabNotify
  • windowUngrabNotify
  • windowResizeNotify
  • windowStateChangeNotify
  • xMotionNotify
  • xCreateNotify
  • xDestroyNotify
  • xFocusIn
  • xFocusOut
  • xMapNotify
  • xUnmapNotify

The last x events are provided by the scripting plugin and are a bit of a hack for the moment until things are clearer with events.

There is also a signal sent out for each compizEvent, these will normally be plugin specific information, I have used it to preload the svgs for the clock.

I have updated the cairo-clock.py script so that it now hides if a window covers more that 1/4 of it. You can change the options at the top of the script.

Known issues

The FiniDisplay function doesnt work as I expect and it doesnt kill off the scripts if compiz is reloaded. cairo-clock tends to die as soon as it notices that the bus is unavailable but the other test scripts do not. Watch out for this for the moment.

It isn't possible to add custom key/button bindings, in theory it should be possible but my quick tests didnt work properly so I have removed it for now.

Download

Direct Download

To install just unpack and type ./install.sh in the directory, this will compile and install the scripting plugin as well as the dbus and annotate plugins that are needed. Make sure all of these are loaded in compiz and then restart compiz to make sure Smile

To run cairo-clock just enter cairo-clock.py in the scripts option and it will be started automatically.