[xmonad] darcs patch: add configurable X Event handling

David Roundy droundy at darcs.net
Mon Nov 12 12:48:11 EST 2007

On Mon, Nov 12, 2007 at 12:11:06PM -0500, Devin Mullins wrote:
> > At this point, I wonder whether we should follow the layouts more closely
> > and make the MessageHooks be data rather than functions, so that they can
> > store state that persists across mod-q.  So we'd have something like:
> *That's* specifically what I don't want. The whole point of eventHook
> (or messageHook) is that it avoids the Read/Show requirement, so users
> can specify custom (in this case) urgency hooks without a load of
> class/instance boilerplate. Otherwise, I'd just leave it as a
> LayoutModifier, as it is now.

I suppose it's a bit of a tossup.  I don't see that as the whole point.  To
me, the whole point would be to allow the definition of hooks that aren't
workspace-specific, as is the case with layout hooks.

Also note that you could make a read-failing messageHook, as you did (I
believe) with your layout modifier, and the users' result would be much
less annoying than losing state.  And we could also allow storing of state
without maintaining it across restarts, which would capture most of the
usefulness of state-storing.

> I'm intrigued with the state idea. What did you have in mind?

What do you mean? How it'd work or what it'd be used for? The most obvious
use would be to simultaneously eliminate the unsafePerformIO global
variable hack from for the urgency hooks, and simultaneously allow the list
of urgent windows to be maintained on restart (if that's what we want).

Another obvious use for state would be to allow us to implement
notification windows (to work with urgent hooks) for instance.  Or to allow
dynamic switching between focus-follows-mouse and click-to-focus behavior.
Or perhaps implementing a "sticky" bit for windows, which causes them to be
automatically added to any new workspaces.  I'm sure more uses will follow
that I haven't yet imagined.  But basically, my expectation would be that
just as layouts are now used for interesting features that are unrelated to
the original "layout" feature (e.g. WorkspaceDir, WindowNavigation, your
urgency layout modifier) I suspect a general event hook will soon be
expected to do more than a static function can describe.  In fact, I think
your UrgencyHook is a perfect example:  it already requires the storage of
David Roundy
Department of Physics
Oregon State University

More information about the xmonad mailing list