[Xmonad] xmobar-0.7rc1 testers needed

Andrea Rossato mailing_list at istitutocolli.org
Wed Jul 18 02:53:14 EDT 2007


On Tue, Jul 17, 2007 at 06:19:13PM -0500, Spencer Janssen wrote:
> It is possible, but annoying.  It requires a magic version of nextEvent that 
> doesn't block inside foreign calls.  Thankfully, this isn't so hard to write 
> with threadWaitRead and XPending.  With this magic nextEvent, we can use 
> asynchronous exceptions to interrupt the thread with a timer.  I've sent you 
> a patch that implements this.


Just a marginal note. I'm thinking about writing a tutorial about X
programming for the Haskell.org wiki.

I think, indeed, that some documentation for writing an X application,
such as a status bar, in Haskell could be useful. My major problem,
indeed, is that I could not find code examples, and I presume I'm not
the only one that can grasp Haskell but have quite some problems in
reading C.

I was lucky because there is this XMonad project going on, with you
guys, real X and/or Haskell experts. Since I'm sure I'm going to
forget everything in a couple of months, if I write it down all the
information that thanks to your help I was able to gather won't get
lost.

This is basically the possible outline of such a tutorial:
1. the process of windows creation and mapping - (with the Hello World
   example)
2. writing to windows (creating a pixmap, writing to it and copying it
   to the window, drawing strings, selecting fonts, colors,
   calculating string length, etc.)
3. handling events

I think the example code could be a simple splash screen that reads a
text file, and displays each row at every mouse bottom press.

And what about mixing events and time driven updates? 

After studying Spencer's code I have the impression that his solution
is the Haskell way of doing this kind of stuff, if I read correctly
the documentation.[1] But I don't now whether I should cover it or
not. I'm afraid it could be confusing and too complicated. On the
other side, since there seems to exist no other Haskell examples of
such a case probably it should be covered and solved with asynchronous
exceptions.

What do you think?

Thanks,
Andrea

[1] http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#14



More information about the Xmonad mailing list