Ikke's Blog

Post details: Python, Cairo, XShape and clocks

Feb 17
Python, Cairo, XShape and clocks

Tonight I wrote some little Python application to play around with Cairo (PyCairo that is), and XShape. The result? Something similar to MacSlow's Cairo-Clock, although much more basic.

Application image

You can find the result in my code section.

Just start it in some terminal. Clicking on the clock allows you to move it, clicking it while pressing a shift keys starts resizing mode. When running on top of a terminal/browser/whatever with scrollbars, try to move your pointer close to the clock's circle, inside the area that's normally covered by the clock's window/frame, then use your scrollwheel. As you should notice, the scroll events are not sent to the clock window, but to the underlying window: it's really a circle, not a transparant rectangular window which still catches all events anyway.

Have fun with it!

Edit: there's a little screencast online. Warning: colors look bad, this is caused by the recording software.

Comments:

Comment from: Wander [Visitor] Email · http://kanslozebagger.org
Nice, it's what I did here: http://kanslozebagger.org/archives/65 as well

pycairo, composite, the whole works, but disguised as a system-monitor/clock.

But I only use xshape when a compositing manager is not available, otherwise I just use a xinput-mask
PermalinkPermalink 02/17/07 @ 18:14
Comment from: Ikke [Member] · http://www.eikke.com
Actually this uses xinput-shape too, not xshape... Good call. Using XShape made window moving flacky.
PermalinkPermalink 02/17/07 @ 19:04
Comment from: Brian Nickel [Visitor] Email · http://kerrick.wordpress.com/
Thank you so much. Trying to navigate cairo-clock's code is a nightmare but this is easy to understand. I've posted a line-for-line rewrite of this in C# on my blog at http://kerrick.wordpress.com/2007/03/01/cairo-xshape-transparency-and-net-together-at-last/
PermalinkPermalink 03/01/07 @ 11:48

This post has 2 feedbacks awaiting moderation...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Categories

Who's Online?

  • Guest Users: 184

Misc

XML Feeds

What is RSS?