[xmonad] New keybinding parser

Brent Yorgey byorgey at gmail.com
Wed Feb 27 07:06:34 EST 2008

On Tue, Feb 26, 2008 at 6:05 PM, David Roundy <droundy at darcs.net> wrote:

> This sounds nice, but I can't help but wonder if we can't do one up, and
> provide our users with a handy interface that doesn't allow them to run
> into run-time parse errors.  Something like
>  (m 'q', action0)
>  (m $ s $ c f12, action1)
>  (m $ s $ c 'x', action2)
> should be trivial to implement (albeit eating up the namespace rather
> ferociously), and would give a bit more safety with only a
> slightly-less-pretty syntax.  Submaps would require a bit more syntax, but
> something like
>  (m x &&& 'q')
> should be implementable.  I'm not sure if this would be deemed worthwhile,
> but it seems to me a bit more elegant than parsing strings into key
> bindings.

Well, you're right that it is more elegant, of course.  It does add some
safety, but I'm not sure how valuable that safety is, especially since
keybindings are one of those things that you mostly leave alone after
initially setting them up.  I also included a function to check the validity
of your keybindings on startup (popping up a little warning message if any
parse failures or duplicates are detected) for exactly this reason.  So in
the end, for me personally at least, the added safety in exchange for having
to write extra syntax ($ and &&& or whatever everywhere) is not a good

That's just my opinion though -- if someone else wants to write an extension
implementing David's suggestion as another keybinding alternative, awesome.
Mine is not necessarily the end-all be-all of keybinding specifications. =)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/xmonad/attachments/20080227/561265c8/attachment.htm

More information about the xmonad mailing list