Denounce: ock, hock; Announce: lal; or, a story of clocks

Earlier this week I wrote about ock, which was a gtk clock that sits in the dock. (I’m trying to avoid the nursery rhyme style here but it’s hard!) ock was neat, but the need of all the weight of gtk brought a bit too much with it. ock’s memory consumption was quite high, and I’m not talking about shared memory either. Using the excellent smem.pl, we can see that (on my vnc setup) it used 836kb of private dirty memory, 492kb of this on the heap (with a vmsize of 520kb). This is a tad high.

This week I decided to rewrite it without the need for gtk. And so, hock (”hacked ock”) was born. The plan was to use an idea from Mikachu to allow openbox’s dock background to show through, and render a clock on top of that.

Starting by using simple X calls, I made a small clock application with a white background and using XDrawString which is a very simplistic call to get X to.. draw a string. It was clear that I needed some sort of nicer printing, so I looked at using pango or cairo to do the dirty work. I eventually chose cairo to render the text, as I thought it would aid in the whole idea of grabbing the background image (of the dock, not the root pixmap) and compositing it together. Mikachu eventually informed of being able to set the background of a window to ParentRelative which made it simply too easy. hock’s memory consumption was far smaller (324kb private dirty, 132kb/244kb heap dirty/heap vmsize), and I was happy. hock looks like this:

hock

Along the same time, Mikachu worked on a similar version that used Xft instead of cairo to do the text rendering, which brought the memory usage down slightly from my cairo version, and required nothing other than X to work. Since cairo wasn’t doing anything, I decided to abort hock and use Mika’s clock, called “lal”. Last night I hacked some crappy command line options into it, improved a bit by Mika, in order to set font face, color, size, and to set the time format string. Maybe today will see .Xdefaults support.

lal doesn’t have one spot at the moment, you can grab it from my repo on l3ib:

git clone git://code.l3ib.org/.users/daf/lal.git

(you’ll want to get the cmdline branch from that)

Also Mikachu’s is at git://comm.it.cx/lal.git

Maybe one day we’ll merge them together properly, and put a license on it, atm I believe Mika wants it to be GPLv2 only. Not sure on that. Oh, and it doesn’t look much different, except all the font look is configurable. Here’s how it is on mine:

lal

Ock/Hock moving

I will no longer be working on ock or hock as lal does what I want it to do. ock and hock can now be found at:

git://code.l3ib.org/.users/daf/ock.git
git://code.l3ib.org/.users/daf/hock.git

If anyone still wants them, I will accept patches.

6 Comments

  1. billy
    Posted 2 Dec 2007 at 10:25 am | Permalink

    Nifty clock. How exactly can you change the colour, time format string, etc?

  2. Dave Foster
    Posted 2 Dec 2007 at 11:06 am | Permalink

    We hacked in support for both command line and Xdefaults parsing recently, it’s in my cmdline branch on l3ib. You can set –(color|font|fontsize|format) or do lal*(color|font|format|fontsize) in your ~/.Xdefaults. lal actually reads Xdefaults directly so no need to xrdb or anything.

  3. Posted 8 Sep 2008 at 5:52 am | Permalink

    I found this via http://urukrama.wordpress.com/openbox-guide

    I just have to say that the thing you came up with is EXACTLY what I was searching for. You might want to consider seeing if you can move this in with Ubuntu the repos.

    I was thinking I would have to hack something together to make a clock work in the dock or that area. Then I saw that this will run in the dock. I tried it, and it looked perfect. It even pulled the system theme. Then I looked at yout source and saw a –help, which didn’t do me any good anymore. I copied the time from a config, and now I run it on login to openbox.

    Again, THANKS!

  4. cireland0307
    Posted 11 Dec 2008 at 6:42 am | Permalink

    I tried to compile this with make, but I get errors about variables no not being declared. This clock looks great, plelase help me so I can get it working.

  5. Posted 21 Apr 2009 at 7:10 am | Permalink

    Hi there :) I’m running a very simple Arch (With openbox) Desktop and just found lal and it’s exactly what I were looking for (gtim is.. Yeah..) but I’m wondering why Lal won’t go “inside” Stalonetray, it just sits in the upper left corner pushing maximized windows aside :/ Anyone know how to “fix” this? :)

  6. Dave Foster
    Posted 21 Apr 2009 at 7:34 am | Permalink

    @Eax:

    AFAIK, Stalonetray just provides a notification area. lal is designed to work in the dock, which is separate from the notification area.

    If you wanted a more unified look, you could use docker to provide a notification area in your dock instead of stalonetray.

4 Trackbacks

  1. By david.chalkskeletons.com » dock stuff on 18 Feb 2008 at 11:16 am

    [...] am running, bbdock, docker, bbpager and lal. It is quite a simple setup, the only slightly odd thing is xdotool, which spoofs keybindings, and [...]

  2. [...] while back, a fellow named Tom Cornall sent me some emails regarding Mikachu and I’s lal clock dockapp. He had hacked in calendar support for it which is quite nice to have. It made the rounds on Planet [...]

  3. [...] it to load the few things I normally required from a panel: a clock (initially bbtime and later lal) and a system tray/notification area (always the simple docker). Later I added bbpager to it, and [...]

  4. By d.minuslab.net » blag » lal 1.0 released! on 23 Sep 2008 at 1:49 pm

    [...] while ago, I wrote about lal, a clock for the dock, after experiments called ock and hock.  Mikachu got the ball rolling and I [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*