PDA

View Full Version : putting composite and cairo to work for a clock


MacSlow
January 21st, 2006, 07:21 AM
Greetings everybody!

First things first... I'm new here in the forums and new to Ubuntu (but not new to Linux). In addition to that I'm not 100% if this post is properly placed in this section of the forums. But well here it goes... I've been doing some coding with cairo under Dapper Drake (flight3) and came up with this analog clock (doh, how boring ;) ). It's not fully done yet, but hopefully by tomorrow or so. I would like to share the first impression with everybody and get further input for addional ideas. Stuff that's still missing and I want to put in the initial version are:

drop-shadow for the clock itself
drop-shadow for the hour/minute/second-hand
a date-display (day, month) as seen on expensive chronographs

Right now it looks like this:

http://macslow.thepimp.net/shots/cairo-clock-1.png

Best regards...

MacSlow

23meg
January 21st, 2006, 07:33 AM
Looks sleek. I'd get rid of the pseudo-shading in the clock face and use a plain one.

MacSlow
January 21st, 2006, 07:48 AM
Looks sleek. I'd get rid of the pseudo-shading in the clock face and use a plain one.

There will be serveral command-line switches to turn on/off certain effects.

Best regards...

MacSlow

23meg
January 21st, 2006, 07:53 AM
There will be serveral command-line switches to turn on/off certain effects.

Appreciated; I've been looking for a good analog clock (http://www.ubuntuforums.org/showthread.php?t=31614) for ages and it seems I've finally found one that suits my taste.

ssam
January 21st, 2006, 08:37 AM
hi.

i spoke to you on irc last week. glad to see that this is coming along well.

melalcoolique
January 21st, 2006, 08:51 AM
Looks very nice. Indeed.

Lovechild
January 21st, 2006, 08:54 AM
That's an awfully big clock, what I wonder is wrong with the slick clock in the panel (aside it's apparent insane ressource requirements).

But you get an A for effort.

MacSlow
January 21st, 2006, 09:16 AM
That's an awfully big clock

It's fully scaleable. That's the beauty of vector-graphics a la cairo. I just resized it to be so big, in order to show it off better in this screenshot. Thus also the smooth graphics provided by cairo are more clearly visible.

what I wonder is wrong with the slick clock in the panel (aside it's apparent insane ressource requirements).

Don't misinterpret my intentions with this clock. I don't want to replace any component of the gnome-desktop. It's rather an above-average coding-example for dealing with gtk+ and cairo in an Composite-enabled environment like Xorg 7.0, which happens to be some nifty eye-candy too :)

But you get an A for effort.

:) Thanks.

Best regards...

MacSlow

poofyhairguy
January 21st, 2006, 04:13 PM
I like it!

Great idea.

MacSlow
January 22nd, 2006, 01:15 PM
A little update on the clock can be found here (http://macslow.thepimp.net/?page_id=23). But it's not for the faint-hearted among you, so be warned. There is little documentation supplied, but at least there is some. Be really sure that you're using cairo 1.0.2 and not cairo 1.1.1 (cvs-head) as there is bug #5681 (https://bugs.freedesktop.org/show_bug.cgi?id=5681) in 1.0.2 that I arrange myself with the code for the time being. So if you are compiling/linking against something differnt than cairo 1.0.2 don't some running to me complaining it does not look like in those shots:

http://macslow.thepimp.net/shots/cairo-clock-2.png
http://macslow.thepimp.net/shots/cairo-clock-3.png

Best regards...

MacSlow

curtis
January 22nd, 2006, 05:48 PM
Wow, well done on your clock it looks really great.
Nice thing that it is scalable as well, bit off topic but it would be nice if every icon in GNOME was scalable and could be used in transparent enviroments... including the notification area.

MacSlow
January 27th, 2006, 10:27 AM
I made a new release (0.2) that improves rendering- and resizing-speed, allows you to fully customize the looks of the clock (via SVG-files) and offers command-line options for the initial window-size and the refresh-interval.

http://macslow.thepimp.net/projects/cairo-clock/cairo-clock-4.png

Direct download-links:
0.2 release tarball (http://macslow.thepimp.net/projects/cairo-clock/cairo-clock-0.2.tar.bz2) (SHA1SUM (http://macslow.thepimp.net/projects/cairo-clock/cairo-clock-0.2.tar.bz2.sha1sum))

Over the last few days since the inital release it spread a bit on the net:

project homepage (http://macslow.thepimp.net/?page_id=23)
its entry at gnomefiles.org (http://www.gnomefiles.org/app.php?soft_id=1259)
its entry at gnome-look.org (http://www.gnome-look.org/content/show.php?content=34256)
its entry at freshmeat.net (http://freshmeat.net/projects/macslows-cairo-clock)
its entry at linux.softpedia.com (http://linux.softpedia.com/get/Desktop-Environment/Tools/MacSlow-s-Cairo-Clock-9114.shtml)

Tell me how you like it and what you dislike. If you made a funky new theme for it send me your SVG-files. I'm planning to add further support for themes in the next versions and would like to ship a few good looking skins users can choose from in the future. Also make sure to take a look at the TODO, NEWS and README files.

Best regards...

MacSlow

autocrosser
January 27th, 2006, 11:06 AM
Very nice take on the MacOSX Clock--I just got your tar & will take a look--I'll see about playing with skins this weekend....I've made several skins for OSX Clock--take a look at--

dudus
February 3rd, 2006, 12:44 PM
Nice! just downloaded... I'll try and let you know

greenpenguin
February 3rd, 2006, 02:14 PM
Nice stuff :D. I'm gonna try that on an LCD screen now, it looks sooo good...

MacSlow
February 4th, 2006, 04:09 AM
I just made the 0.3 release available. Noteworthy additions from 0.2 to 0.3 are...


persistence (all settings are remembered)
performance-tuning (uses surface buffering)
desktop menu-entry (see Applications/Accessories)
preferences dialog (quite HIG-compliant)
on-the-fly theme-switching
four themes (default, fdo, glassy, simple)
more command-line arguments (try --help)
binary- and source-rpms (for FC5test2)


The new versions (and the new themes) look like this...

http://macslow.thepimp.net/shots/cairo-clock-6.png

You can grab it from here (http://macslow.thepimp.net/?page_id=23#mark_8), here (http://www.gnomefiles.org/app.php?soft_id=1259), here (http://www.gnome-look.org/content/show.php?content=34256), or here (http://freshmeat.net/projects/macslows-cairo-clock).

Sorry, but .debs are still missing. Although I try to get them done before monday. But to try the new version without "spoiling" your filesystem you can e.g. do a "mkdir /tmp/test-cairo-clock; ./configure --prefix=/tmp/test-cairo-clock; make ; make install" without the need to be root. But be sure to check the requirements!

If you make stylish new themes for it send them to me! I'll add the coolest themes in future releases (with credits of course :D ).

Best regards...

MacSlow

MadMan2k
February 4th, 2006, 05:38 AM
where did you actually take use of composite? I thought it would be only used by the Xserver and be thus transparent for other programs. Or is there a way to access it directly?

MacSlow
February 4th, 2006, 06:04 AM
where did you actually take use of composite? I thought it would be only used by the Xserver and be thus transparent for other programs. Or is there a way to access it directly?

I do not directly use the X11-Composite extension via any dedicated system-calls, if that's what you wonder about. The reason for the way I phrased the topic, was to make very clear that a working and enabled Composite-extension (in addition with a running compositing-manager) is needed in order to get the nice floating look of the clock. I want to prevent people (who are not that deep into X11 and related technology) emailing me that they cannot get it working or the clock doesn't look like as shown in the screenshots on their systems.

Best regards...

MacSlow

bluebyt
February 4th, 2006, 08:02 AM
Very nice looking clock! I wish I have dapper
keep up the good work!

MacSlow
February 5th, 2006, 11:10 AM
I just uploaded the promised .deb for Ubuntu Dapper Drake. Thanks to some fine folks from the community there are also packages for FC5test2 and Gentoo too now. Check it all out at...

the usual place (http://macslow.thepimp.net/?page_id=23#mark_8)

Best regards...

MacSlow

Beire
February 5th, 2006, 11:18 AM
works great :) nice clocky

MacSlow
February 21st, 2006, 05:57 PM
I just released the 0.3.1 version of my cairo-clock. Get it while it is still fresh at this place (http://macslow.thepimp.net/?p=27). Here's a little appetizer:

http://macslow.thepimp.net/shots/small_cairo-clock-7.png (http://macslow.thepimp.net/projects/cairo-clock/cairo-clock-7.png)

Best regards...

MacSlow

UbuntuUX
February 21st, 2006, 06:18 PM
Really nice clocks, love the radium one and great work. It also wobbles when you move it about with compiz :)

UbuWu
February 21st, 2006, 06:32 PM
It gets looking better everytime! :KS

aamukahvi
February 21st, 2006, 06:36 PM
Works great for me on Compiz. Lookin' good :)

cro.smiley
February 22nd, 2006, 07:52 PM
Hi, is there any way to make it run on Breezy?

engla
February 22nd, 2006, 08:04 PM
Hi, is there any way to make it run on Breezy?
From what I can see, only librsvg is blocking the complete breezification.. I suspect that's a huge "only" though [I guess].

MacSlow, anything we breezy users can do? It looks like my dream clock I had in gdesklets but wayy cooler (and speedier).

bluebyt
February 24th, 2006, 06:03 AM
Is there a way to stick it to the desktop, because when I click show desktop the clock disappear!

Keep up the good work!

SimonJW
February 24th, 2006, 07:23 AM
Using this with the Compiz wm with Wobbly setting produces some fairly Dali-esque effects!
6400

Nice work :)

MacSlow
February 24th, 2006, 08:14 AM
Hi, is there any way to make it run on Breezy?

The main blockers are Xorg 6.9/7.0 and librsvg (>= 2.13.93). But I heard from people that they have gotten Xorg 6.9/7.0 installed on Breezy. Might be possible for librsvg too. But I didn't go that path myself. I've have breezy for a stable environment and Dapper for cracktastic hacking around.

I don't want to do a cairo-clock .deb for breezy that has all sorts of non-stable dependencies in it. It would kind of introduce breakage of all sorts and give an overall bad impression.

A sidenote: Xorg 6.9/7.0 is needed for working ARGB-windows from gtk+ (in combination with a compositing manager, e.g. xcompmgr, compiz) and librsvg is for being able to loading/render SVGs via cairo.

Best regards...

MacSlow

MacSlow
February 24th, 2006, 08:22 AM
From what I can see, only librsvg is blocking the complete breezification.. I suspect that's a huge "only" though [I guess].

You're right :)

MacSlow, anything we breezy users can do? It looks like my dream clock I had in gdesklets but wayy cooler (and speedier).

I guess it is possible, if you are willing to put your stable breezy through putting Xorg 6.9/7.0 on it. Same goes for librsvg. But like I mentioned in the last post... I don't want to "persuade" people to run into headaches with their stable systems just for a clock. Thus I don't offer a breezy .deb

But if you're willing to put yourself through it... well go for it. If you think it's worth it, well that's your decision.

Best regards...

MacSlow

MacSlow
February 24th, 2006, 08:25 AM
Is there a way to stick it to the desktop, because when I click show desktop the clock disappear!

Yes, 0.3.1 has it. It was a requested feature... and btw RTFM ;)

Keep up the good work!

I'll try my best... next thing will probably by some skydome-plugin for compiz.

Best regards...

MacSlow

jannol
February 25th, 2006, 01:01 PM
Yes, 0.3.1 has it. It was a requested feature... and btw RTFM ;)


Maybe I am beeing stupid but if I understood correctly bluebyt ment when he clicks show desktop button and all open windows gets minimized including cairo-clock. Is there an option for that ? I sure didn't find it but since I have devilspie installed it was simple, I just put


(if
(is (application_name) "cairo-clock")
(begin
(wintype "dock")
(pin)
)
)


in a file named ~/.devilspie/cairo-clock.ds

Really great job MacSlow, I used to run gtubeclock but this is better as in 'I can just change the theme when I like'. I got tired on gtubeclock and it doesn't fit my theme anymore, I'll try to create a theme.

cokehabit
February 25th, 2006, 01:05 PM
It's fully scaleable. That's the beauty of vector-graphics a la cairo. I just resized it to be so big, in order to show it off better in this screenshot. Thus also the smooth graphics provided by cairo are more clearly visible.



Don't misinterpret my intentions with this clock. I don't want to replace any component of the gnome-desktop. It's rather an above-average coding-example for dealing with gtk+ and cairo in an Composite-enabled environment like Xorg 7.0, which happens to be some nifty eye-candy too :)
You can't believe everything you hear from lovechild...

jannol
February 28th, 2006, 04:29 AM
Well, I tried to create a theme yesterday and it was the first time I tried inkscape. When I did I noticed that I accidentally got details that reminded me of tango so I did a few small changes.

Anyway, I am not all that satisfied but hey, gotta begin somewhere.

shot (http://linux.jannol.com/ubuntu/shots/notround.png)

themes (http://linux.jannol.com/ubuntu/cairo-clock_themes/)

MacSlow
February 28th, 2006, 06:54 AM
Maybe I am beeing stupid but if I understood correctly bluebyt ment when he clicks show desktop button and all open windows gets minimized including cairo-clock. Is there an option for that ? I sure didn't find it but since I have devilspie installed it was simple, I just put


(if
(is (application_name) "cairo-clock")
(begin
(wintype "dock")
(pin)
)
)


in a file named ~/.devilspie/cairo-clock.ds

Really great job MacSlow, I used to run gtubeclock but this is better as in 'I can just change the theme when I like'. I got tired on gtubeclock and it doesn't fit my theme anymore, I'll try to create a theme.

Damn it! Stupid me... indeed the clock gets minimized too. I thought I tried it and "protected" cairo-clock form minimizing by setting the right options. I'll add a proper way to protect it from getting minimized.

If for the meantime this script of yours does the job too, then that's a good workaround for this shortcoming of cairo-clock.

Thanks for this hint!

Best regards...

MacSlow

MacSlow
February 28th, 2006, 07:02 AM
Anyway, I am not all that satisfied but hey, gotta begin somewhere.

shot (http://linux.jannol.com/ubuntu/shots/notround.png)

themes (http://linux.jannol.com/ubuntu/cairo-clock_themes/)

Ah... a creative mind at work... the second "3rd-party" theme :) Looking good for a start! I like the basic rectangular shape of it. And thus going along a way to be "compatible" with the Tango-style isn't a bad idea too. Keep it going! When you're done drop me an email or try to run into me on IRC (-> #ubuntu @ irc.freenet.org).

BTW, I guess what would be nice too, if others could get some distro-specific themes going... one ubuntu-theme, a fedora-one etc... each with a special twist to look unique. So not just a simple round clock with the distro-logo somewhere, e.g. the new fedora-logo has an interesting shape. Or the three parts of the ubuntu-logo might be used in a clever way for a clock.

Best regards...

MacSlow

SickTwist
February 28th, 2006, 07:34 AM
Thank you! I just installed v0.3.1 in Dapper and I'm running it now with Xgl/Compiz. It's absolutely gorgeous! Also, I appreciate your providing the deb package. Installation was a breeze.

MacSlow
February 28th, 2006, 02:55 PM
Thank you! I just installed v0.3.1 in Dapper and I'm running it now with Xgl/Compiz. It's absolutely gorgeous! Also, I appreciate your providing the deb package. Installation was a breeze.

That's what it is meant for... power (simplicity) to the people! Besides, I'm myself running Dapper here so doing a .deb for it was an inevitable thing to happen :)

Best regards...

MacSlow

jjfran
February 28th, 2006, 04:33 PM
Is possible to make a dock like Macosx with this (cairo and composite)?. I think that it's a good idea but i don't have idea how to do it.

MacSlow
February 28th, 2006, 06:49 PM
Is possible to make a dock like Macosx with this (cairo and composite)?. I think that it's a good idea but i don't have idea how to do it.

Yes, this is doable. Since it is possible to use cairo (hence SVGs via librsvg) it would even be more advanced than the MacOS X dock. As far as I know the OS X dock is not vector-based but still bitmap-based. The stuff in that OS X dock only looks so crisp because the used icons are of high resolution (256x256 I believe).

The only issue that might arise is the redraw-performance involved. As long as one cannot expect a wide spread of cairo/glitz-capable desktop machines the target-audience is still a bit small. But the redraw-performance (mainly of interest if animation is concerned) can be worked around by the use of image-surface buffers. Just like cairo-clock uses them. But this is only needed if no glitz is used as render-backend for cairo.

All in all there's no technical obstacle that would stop anyone from doing something like the OS X dock for a modern linux desktop machine right now.

Best regards...

MacSlow

engla
March 6th, 2006, 12:32 AM
I finally tried to put this on my Breezy install.. it turned out to be super simple!

Steps
1. I already have Xorg 6.9 from the DRI instructions, compiled from sources this January
2. Got the sources for latest librsvg (2.14.1 [rc1 I presume])... installed the dependencies from breezy repositories (libcroco and libgsf dev files)
3. Built librsvg and installed in /usr/local so it's parallel with my old version
4. Cairo-clock now built like a charm, thanks :-)
The Zen display is nifty! And with skippy-xd [expose-wannabe], the clock updates live when thumbnailed! (I suspect this is how it works for yall in dapper/xgl too...)

One feature suggestion: A stick to desktop option (if it's possible?). That way you can press ctrl-alt-D to hide all windows but have the clock stay so you can see it. The clock would also always be below other windows.
Edit: I noticed this has been beaten to death already in this thread, so well disregard the above.


I have ppc debs for librsvg and cairo-clock now if someone wants them...

MacSlow
March 8th, 2006, 07:29 PM
Hi engla!

I have ppc debs for librsvg and cairo-clock now if someone wants

If you want I can host the PPC .deb for cairo-clock on my site (with credits of course).

Best regards...

MacSlow

bluebyt
March 9th, 2006, 09:13 PM
It should be nice if the clock have an option to save position on the desktop.
I always need to change position to have it where I like it!

MacSlow
March 9th, 2006, 10:09 PM
It should be nice if the clock have an option to save position on the desktop.
I always need to change position to have it where I like it!

It actually saves it's position and size at exit and uses that saved info on the next startup. Which version of cairo-clock do you run?

Best regards...

MacSlow

dietrying
March 11th, 2006, 12:46 PM
i would like to have a ppc deb ......i use dapper

bluebyt
March 19th, 2006, 07:17 AM
It actually saves it's position and size at exit and uses that saved info on the next startup. Which version of cairo-clock do you run?

Best regards...

MacSlow

Version 0.3.1

jakes
March 19th, 2006, 11:38 PM
I'm also running 0.3.1 (installed from your .deb) and am having the same problem - the clock always reverts to the same position on start-up. Currently I'm starting it via Sessions>Startup Programs, and it starts at the top-left of the screen. Anything I need to change to fix this, or is it a bug?
I love everything else about this clock, though.

mattisking
March 20th, 2006, 01:13 AM
This used to happen to me as well (not remembering where I put the clock) but just recently this seems to have taken care of itself. It now comes up where I want it to. Weird.

cerebrix
March 20th, 2006, 01:54 AM
loving this so far. thanks for taking the time to do it =D

any plans to make any other cairo enabled apps? this feels like the start of something that could compete with vista's (and stardock's and konfabulator) desklets (gdesklets doesnt even begin to compete with them the ms and stardock and konfabulator stuff is just flat tons better)

maybe a vector based gkrellm or similar system monitor?

anyway, thanks again for takin the time to do it. this little clock rocks.

saads
March 20th, 2006, 02:12 AM
I'm also running 0.3.1 (installed from your .deb) and am having the same problem - the clock always reverts to the same position on start-up. Currently I'm starting it via Sessions>Startup Programs, and it starts at the top-left of the screen. Anything I need to change to fix this, or is it a bug?
I love everything else about this clock, though.
Try putting it where you want, manually closing it (right click -> close) and then running it again. It should reopen where u left it. For some reason if it gets killed during logout it doesn't save its position. After that it should stay put.

jakes
March 20th, 2006, 04:03 AM
Try putting it where you want, manually closing it (right click -> close) and then running it again. It should reopen where u left it. For some reason if it gets killed during logout it doesn't save its position. After that it should stay put.
That seems to have fixed it. Thanks.

MacSlow
March 20th, 2006, 04:52 AM
Hm... I thought I fixed that. I mean not only saving the current position and size on exit but also after each position/size-change. I'll have to re-check that again. Since lowfat (http://macslow.thepimp.net/?page_id=18) got a bit more exposure than planned it has been quite busy here for me.

Best regards...

MacSlow

eshehi
March 27th, 2006, 03:18 AM
I installed it today. I am running it under Dapper and I have Aiglx/compiz installed. If I dont run compiz and start the clock there is the black square in the background. When I run Compiz the whole clock become a white square.
How can i fix this.
Thanks in advance.

MacSlow
March 27th, 2006, 03:50 AM
I installed it today. I am running it under Dapper and I have Aiglx/compiz installed. If I dont run compiz and start the clock there is the black square in the background.

*doh* (http://macslow.thepimp.net/?page_id=23#mark_7)

When I run Compiz the whole clock become a white square.
How can i fix this. Thanks in advance.

That white square thing is a bug in compiz. I have that too (http://www.ubuntuforums.org/showpost.php?p=864033&postcount=505). Earlier versions of compiz show that cairo-clock works well (http://macslow.thepimp.net/clips/wobbly-clock-1.avi), if compiz is running ok.

Best regards...

MacSlow

dentaku65
March 31st, 2006, 11:46 AM
I get white square instead of the clock here too.
I'm running AIGLX+compiz without a problem on my i810 video device with KDE...

christhemonkey
April 25th, 2006, 04:04 PM
Finally got this clock to work on breezy as well!
Compiled it from source with all dependencies and stuff.
http://img520.imageshack.us/img520/5615/screenshot7og.png

bluevoodoo1
May 6th, 2006, 01:23 PM
This is great! Thank you!!!

adam.tropics
May 9th, 2006, 08:46 AM
Love it, thanks for all the work. (playing with your themes a bit!)

9252