[xmonad] Re: Use regexps for className matching?

Don Stewart dons at galois.com
Mon Feb 9 11:24:17 EST 2009


mail:
> Henri Ducrocq <henri.ducrocq at gmail.com>
> writes:
> | For example
> |   className =? "Google Mail"  --> doShift "1"
> |   className =? "Google Calendar"  --> doShift "1"
> | would become
> |   className <some regexp matching operator> "Google .*" doShift "1"
> |
> | How to do this in Haskell? I couldn't find any examples of this in the config
> | archive..
> 
> You can use one of the haskell regex libraries and define an operator
> for the managehook like so:
> 
> > import Text.Regex.Posix ((=~))
> >
> > q ~? x = fmap (=~ x) q
> 
> and then your example is simply
> 
> > className ~? "Google .*" --> doShift "1"

Having someone interested write an extension module of regex combinators
for this kind of thing would be useful.

-- Don


More information about the xmonad mailing list