[Xmonad] More user-friendly hook system

David Roundy droundy at darcs.net
Wed Oct 10 14:04:38 EDT 2007


On Wed, Oct 10, 2007 at 04:04:36PM +0000, Joachim Breitner wrote:
> Hi,
> 
> 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

No, the core would remain unchanged, since the core API is unchanged, and
the record would be defined in Contrib.  Why would you need to define a
record for your hook type in the core?

> > 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.

I'm not convinced that there will be such a proliferation of hooks that
many users will ever do this.  I suppose that's largely because I don't
yet use any myself, and haven't seen any reason to define any.

I'd rather see the core API only complicated when there's a feature that
can't be added without the complication (as happened with layouts) or when
it makes things much simpler (or is needed for a reasonable core
functionality, as with LayoutSelection).

I'd say that one line and a dozen characters added to the Config file is
well worth the ability to experiment freely, and allowing us to see and try
out code.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list