Same className, different titles --> same managehook

I want to apply a similar configuration to some specific "children" from a window. I've been mixing managehooks, but looks very repetitive. 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? Regards, -- Pablo Olmos de Aguilera Corradini - @PaBLoX http://www.glatelier.org/ http://about.me/pablox/ http://www.linkedin.com/in/pablooda/ Linux User: #456971 - http://counter.li.org/

On Sat, Oct 27, 2012 at 1:07 PM, Pablo Olmos de Aguilera C. < pablo@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@gmail.com ballbery@sinenomine.net unix/linux, openafs, kerberos, infrastructure http://sinenomine.net

Quoting "Pablo Olmos de Aguilera C."
I want to apply a similar configuration to some specific "children" from a window. I've been mixing managehooks, but looks very repetitive.
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?
How about this? floatPanel t = className =? "Xfce4-panel" <&&> title =? t --> doFloat and then, in your manage hook, composeAll [ floatPanel "Panel", floatPanel "Add New Items", .... ] Of course floatPanel can be generalized or specialized in a couple million different ways, depending on exactly what you want to do. ~d

On 27 October 2012 14:24, Brandon Allbery
One possibility is
className =? "Xfce4-panel" <&&> fmap (\t -> any (== t) ["Panel", "Add New Items", ...]) title
I wasn't so lost, I was somehow close. I'm still trying to learn lambdas.
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
Thanks, this looks a little better and elegant. I still have a lot to learn D:
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.
It's a good idea because gives more control. Thanks for your suggestion.
On 27 October 2012 16:59,
How about this?
floatPanel t = className =? "Xfce4-panel" <&&> title =? t --> doFloat
and then, in your manage hook,
composeAll [ floatPanel "Panel", floatPanel "Add New Items", .... ]
Of course floatPanel can be generalized or specialized in a couple million different ways, depending on exactly what you want to do. ~d
Thanks, I never thought in doing something like that, I should've been able to do it, well... there's still a lot to learn. Thanks both of you! (again :P) Regards, -- Pablo Olmos de Aguilera Corradini - @PaBLoX http://www.glatelier.org/ http://about.me/pablox/ http://www.linkedin.com/in/pablooda/ Linux User: #456971 - http://counter.li.org/
participants (3)
-
Brandon Allbery
-
Pablo Olmos de Aguilera C.
-
wagnerdm@seas.upenn.edu