[Xmonad] More user-friendly hook system

Joachim Breitner mail at joachim-breitner.de
Wed Oct 10 12:04:36 EDT 2007


Am Mittwoch, den 10.10.2007, 11:56 -0400 schrieb David Roundy:
> On Wed, Oct 10, 2007 at 10:48:52AM -0500, Spencer Janssen wrote:
> > I think this would be very useful for contrib modules, put perhaps less easy
> > to use for regular users.  I'm going to delay discussion until after the 0.4
> > (which should come later this week) release, to make sure we have time to
> > find a nice design.
> Also, note that these proposals could all be implemented in a contrib
> module as a function such as:
> combineHooks :: [... -> ... -> ...] -> ... -> ...
> so it's hard to see why we'd want to put this in the core (unless the core
> wants it).

We still would need the record definition in the core, as that is where
hooks are called and where new hooks are added. And I think requiring
the user to write

> import XMonadContrib.CombineHooks
> xmonadHook = combineHooks [ .. ]

instead of just

> xmonadHooks = [ .. ]

whenever they want to use more than one extension, just to safe half a
line of code in all the places where hooks are called does not seem to
be worth it.

If we’d add a 

> instance Monoid XMonadHook where ..

then combining the hooks is just a matter of using 
> mconcat Config.xmonadHooks
instead of
> mconcat Config.xmonadHook
so really no hassle, I’d say.

I agree with Spencer that this should not go in before the next release,


Joachim "nomeata" Breitner
  mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: joachimbreitner at amessage.de | http://www.joachim-breitner.de/
  Debian Developer: nomeata at debian.org

More information about the Xmonad mailing list