Lua Gtk Engine

I’ve been working on a Lua based scripting engine for Gtk themes. Right now it isn’t really useful without example themes and documentation, so I will write more about it later. If you want to try it anyway, get gtk-engines from CVS and configure with –enable-lua. It still needs some work, many widgets aren’t supported yet.

For the API I’ve tried to find a middleground between flexibility and simplicity. It is based on simple drawing functions with parameters, for example: rectangle {x=0, y=0, width=200, height=200, radius=3, filled=true, color={1, 0, 0}}. Most parameters are optional. It is possible to specify both colours and gradients (linear and radial) with arbitrary colour stops. The nice thing about passing parameters like this is that you can store and modify them in a Lua table, for example:

myrect = { x=0, y=0, width=200, height=200 }
myrect.color = {1, 0, 0}
rectangle (myrect)

There is also a shape () function which takes an arbitrary number of normal and bezier points to create any shape you want. A screenshot that shows most of the current widget coverage:

Lua Engine

Writing themes like this is a lot more fun, especially since you don’t need a recompile and restart anymore before you can try your changes. But most importantly users will be able to install Lua themes like any other theme via drag and drop, instead of having to install a new engine, just because they prefer their Clearlooks to have square corners… Performance seems to be completely acceptable so far. The difference is measurable, but almost neglectable compared to the actual drawing times. Lua is a scripting language that was developed with speed and size in mind, so it adds minimal overhead.


For chessmonk, I decided to split up the chess board part into a separate package. Not just the display but also any chess logic will be contained in this package, so it will become easier to create different board window types. I got this idea when reading about a software called Chess Position Trainer, which is based on a similar chess board widget. This still needs a lot of work and isn’t functional yet, but if you are curious you can find it in the gtkboardview branch of the Subversion repository.

Chess Tournament

I didn’t dare blog about this before, because I assumed it must bring bad luck. 😉 I recently played a seven round swiss tournament in Krefeld and surprisingly was able to reach fourth place with a performance of over 2100 (Final Standings).

In the last round I had white against the third seed of the tournament (2060 DWZ). I didn’t really expect to win this game and reach the price ranks, but then it even became a nice miniature after my opponent made a mistake soon after the opening moves:

1.d4 g6 2.c4 Bg7 3.Nc3 d6 4.e4 Nf6 5.Nf3 O-O 6.Be2 e5 7.O-O Nc6 8.d5 Ne7 9.a4 a5 10.b3 Nd7 11.Ba3 h6 12.Ne1 f5 13.f3 b6 14.Nd3 Nf6 15.b4 axb4 16.Bxb4 Nh5 17.a5 c5 18.dxc6 bxa5? 19.Nb5 Be6? 20.c7 Qd7 21.Bxd6 Bxc4 22.Nxe5 1-0


9 responses to “Updates

  1. Hi Daniel!

    Have you seen the pychess project on GoogleCode? http://code.google.com/p/pychess/
    Can we merge our codebases/efforts somehow?


  2. OK, i’v just seen you posted to the list, so you know about us 🙂

  3. I’ve also mailed you. 😉

  4. hi dborg
    can you give precisions about lua-gtk
    i hope you’ll answer more than on irc 🙂

  5. the most important for me is
    can i use lua-gd with lua-gtk ?
    ex : to generate images and colors
    with result from lm-sensor
    and use it in lua-gtk theme ?
    so fun !

  6. Pingback: Updates « dborg’s Journal

  7. Nice idea, embedding Lua in a GTK theme engine… just found a “libluaengine.so” while browsing my lib/gtk directory (ubuntu hh). So I went and googled it, and eventually came here.

    I really was hoping to find some documentation but I guess I’m just out-of-luck. Maybe you could provide a basic “gtkrc” showcasing what can be done?

    “Documentation is like sex, even bad one is better than none” 😉

    Viele Grüße

  8. I am simply writing for 2 reasons: first, I’d like to request your prompt permission to display the liblua-image on my blog; I also want to comment on the design of your own blog. I must say that I do admire the layout, choice of color and finally, the content.

    If one’s content isn’t worthy, the design of one’s site makes no difference now, does it? Please feel free to visit my blog: The Free Thinking Proletariat and leave whatever comments, criticisms advice or opinions you deem relevant after reviewing the site. Please be prompt with a reply and once again, thank you for serving as such an admirable example to us “greener” bloggers

  9. There’s good info here. I did a search on the topic and found most people will agree with your blog. Keep up the good work mate!

    I’m Out! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s