ManageHook question

Hi all, If I wasn't still an almost total Haskell newbie, this would probably be easy for me to answer for myself. As is... If I want to have a manage hook that will run anytime a window title contains a string how do I do that? For example title =? 'downloads' --> doIgnore but instead of exactly matching title against 'downloads' we want to run the doIgnore for any window whose title contains 'downloads'. -Sean-

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 3/5/11 02:28 , Sean Allen wrote:
title =? 'downloads' --> doIgnore
but instead of exactly matching title against 'downloads' we want to run the doIgnore for any window whose title contains 'downloads'.
It's kinda ugly: ("downloads" `isInfixOf`) `fmap` title --> doIgnore or equivalently fmap (isInfixOf "downloads") title --> doIgnore More generally, to apply a comparison operation of some kind to a Query string, use "fmap" to run it "inside" the Query. So you can read the first version somewhat naturally as 'run ("downloads" `isInfixOf` x) with "x" being the string inside of "title"'. (You will probably need "import Data.List (isInfixOf)" at the top of your xmonad.hs.) - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery.b@gmail.com system administrator [openafs,heimdal,too many hats] kf8nh -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1x6hoACgkQIn7hlCsL25VYYwCfbavF3cPlpTtcM8pq6K2gGsP+ Vr8An3O1VH7zrShw3s17E8TyBOZRK6He =PJin -----END PGP SIGNATURE-----

Thanks Brandon.
I'm constantly amused by what haskell I can figure out to get stuff
working in and what I can't.
I'm going to dig deeper into your explanation and hopefully really
learn something.
On Sat, Mar 5, 2011 at 2:45 AM, Brandon S Allbery KF8NH
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 3/5/11 02:28 , Sean Allen wrote:
title =? 'downloads' --> doIgnore
but instead of exactly matching title against 'downloads' we want to run the doIgnore for any window whose title contains 'downloads'.
It's kinda ugly:
("downloads" `isInfixOf`) `fmap` title --> doIgnore
or equivalently
fmap (isInfixOf "downloads") title --> doIgnore
More generally, to apply a comparison operation of some kind to a Query string, use "fmap" to run it "inside" the Query. So you can read the first version somewhat naturally as 'run ("downloads" `isInfixOf` x) with "x" being the string inside of "title"'.
(You will probably need "import Data.List (isInfixOf)" at the top of your xmonad.hs.)
- -- brandon s. allbery [linux,solaris,freebsd,perl] allbery.b@gmail.com system administrator [openafs,heimdal,too many hats] kf8nh -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk1x6hoACgkQIn7hlCsL25VYYwCfbavF3cPlpTtcM8pq6K2gGsP+ Vr8An3O1VH7zrShw3s17E8TyBOZRK6He =PJin -----END PGP SIGNATURE-----
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
participants (2)
-
Brandon S Allbery KF8NH
-
Sean Allen