[xmonad] float, match by regex?
intrigeri at boum.org
intrigeri at boum.org
Thu Mar 5 05:58:39 EST 2009
Wirt Wolff wrote (15 Feb 2009 23:58:25 GMT) :
> Excerpts from lowly coder's message of Sun Feb 15 15:42:32 -0700 2009:
>> so in .xmonad/xmonad.hs, I see how i can make a window float, by selecting
>> it's title; however, suppose I wnat a bunch of windows to float, i.e.:
>>
>> is it possible to instaed of listing out all titles, specify a regex, or a
>> function that goes [Char] -> Bool ? (for deciding whether to float the
>> window or not)
Here's some bits of code that may help achieving what you want,
although it does not support regexps.
It allows to float a bunch of windows and/or send them to a given
workspace, depending on some X properties. Please forgive my poor
Haskell skills.
data PropertyName = AppName
| ClassName
| Title
type PropertyValue = String
myManageHook = manageDocks
<+> sendTo "Web" [ (AppName, [ "Gecko" ])
, (ClassName, [ "Epiphany", "Epiphany-browser"
, "Firefox-bin"
, "Iceweasel" ])
]
<+> float [ (AppName, [ "float" ])
, (ClassName, [ "Gimp", "Scribus", "Scribus-ng"
, "Xmessage"])
]
where
sendTo :: WorkspaceId -> [(PropertyName, [PropertyValue])] -> ManageHook
sendTo wksp ((p, vs):xs) = composeAll (map sendIfMatch vs) <+> sendTo wksp xs
where
sendIfMatch v = propertyMatcher (p) =? v --> doShift wksp
sendTo wksp _ = idHook
float :: [(PropertyName, [PropertyValue])] -> ManageHook
float ((p, vs):xs) = composeAll (map floatIfMatch vs) <+> float xs
where
floatIfMatch v = propertyMatcher (p) =? v --> doFloat
float _ = idHook
propertyMatcher :: PropertyName -> Query String
propertyMatcher p = case p of
AppName -> appName
ClassName -> className
Title -> title
bye,
--
<intrigeri at boum.org>
| gnupg key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
| We're dreaming of something else.
| Something more clandestine, something happier.
More information about the xmonad
mailing list