[xmonad] Same className, different titles --> same managehook

Brandon Allbery allbery.b at gmail.com
Sat Oct 27 19:24:15 CEST 2012


On Sat, Oct 27, 2012 at 1:07 PM, Pablo Olmos de Aguilera C. <
pablo at glatelier.org> wrote:

>     composeAll
>     [ className =? "Xfce4-panel" <&&> title =? "Panel"          --> doFloat
>     , className =? "Xfce4-panel" <&&> title =? "Add New Items"  --> doFloat
>     ......
>     ] <+>
>
> Which strategy should I use to make the same className applies to
> different titles?
>

One possibility is

    className =? "Xfce4-panel" <&&> fmap (\t -> any (== t) ["Panel", "Add
New Items", ...]) title

This can probably be made prettier.

    matchAny :: Eq a => Query a  -> [a] -> Query Bool
    matchAny t ts = fmap (\s -> any (== s) ts) t

    className =? "Xfce4-panel" <&&> matchAny title ["Panel", "Add New
Items", ...] --> doFloat

Another possibility, depending on exactly what you're trying to do, is

    className =? "Xfce4-panel" -->
      composeAll [title =? "Panel" --> doFloat
                 ,title =? "Add New Items" --> doFloat
                 ]

and then rearrange the inner composeAll in various ways.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix/linux, openafs, kerberos, infrastructure          http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20121027/9a02d7b3/attachment.htm>


More information about the xmonad mailing list