PDA

View Full Version : Cairo clock - the return


mikedee
November 20th, 2006, 02:26 PM
Here is my first version of the MacSlow cairo clock written using python and a modified version of the annotate plugin.

To run it you will need to make sure that you have the python dbus bindings installed and that you install the modified annotate plugin.

The theme, size and position can be configured by editing the script at the top.

The only known problem at the moment is that it slows things down a bit. This is because it reloads the svg's on each tick, there is a limitation in the core which means I cannot preload them yet.

To install download the tarball and extract it somewhere, then go to the directory and type make install, then reload compiz, make sure the annotate plugin is loaded. Then launch the clock by typing ./cairo-clock.py &

http://www.anykeysoftware.co.uk/compiz/annotate-cairo-clock.tar.gz

You will also need to install my patched dbus plugin available here, just download unpack and type make install.

http://www.anykeysoftware.co.uk/compiz/plugins/dbus.tar.gz

My eventual aim is to make it so that the clock shows on a keypress.

MacSlow
November 21st, 2006, 12:22 AM
Greetings Mike!

What's causing this need to reload the SVGs for each rendered frame?

Best regards...

MacSlow

mikedee
November 21st, 2006, 12:41 AM
Hi :)

The reason for not storing the svg handles in the plugin is because I wrote this as a proof of concept for scripting compiz effects using any language + dbus. I extended the annotate plugin so that it was a generic cairo graphics renderer and so I couldnt have clock specific code in it.

This means that I can still preload the svg's but any commands for loading them should go over dbus and a handle (just an int id) for the svg that was loaded will be returned. At the moment dbus only handles actions with no information being returned. We would need to have an action that could return values to allow for them to be preloaded over dbus.

This test went fairly well, the python only took about an hour to do. I am planning to extend the scripting interface so that the python code can register keybindings to hide. After that I will connect the window notifications so that the clock could hide when certain window types are shown.

Hopefully that makes things clear ;)

nzjrs
November 29th, 2006, 03:09 AM
Hey,

Sorry for my ignorance but I cant see what the big picture use-cases are for converting cairo-clock to this.

Basically it uses the annotate plugin to draw directly instead of going through gtk+cairo toolkits like original cairo-clock did?

Also how does this relate to the scripting plugin.... Does rewiting cairo clock like this allow it to react to all sorts of cool events like when a window is covered?

John

p.s. Screenshots?

mikedee
November 29th, 2006, 04:27 AM
Hey,

Sorry for my ignorance but I cant see what the big picture use-cases are for converting cairo-clock to this.

Hey :) There are lots of possibilities that I can think of, mostly things like notifications, because it is controllable by scripting people can quicly hack up their own osd display of what they want (this could be stats from a website for example). My idea is to give people the opportunity and then hopefully they can come up with the ideas, something like the greasemonkey firefox extension (except hopefully without the security problems ;)). This also demonstrates my general overall idea of scripts harnessing the compiz plugins effects for their own use (like shared libraries). The im drop notification you may have seen is a basic example of this.

Basically it uses the annotate plugin to draw directly instead of going through gtk+cairo toolkits like original cairo-clock did?

Yep, its python -> dbus -> cairo -> compiz rather than c -> cairo+gtk

Also how does this relate to the scripting plugin.... Does rewiting cairo clock like this allow it to react to all sorts of cool events like when a window is covered?

Exactly, that is what I have done here for the 0.9 release of the scripting plugin. The scripting plugin is a very simple wrapper which deals with loading of scripts, it also (will) deal with stopping the scripts when compiz stops. A lot of the work I have done is in the dbus and annotate plugins which is included in the scripting plugin download.

http://forum.go-compiz.org/viewtopic.php?t=138

p.s. Screenshots?

Its not exactly something that is screenshot friendly, it just shows cairo clock in the top left of the screen. The difference is that it sticks when you rotate the cube and it can autohide when a window covers it.