float, match by regex?
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.: "float1" "float2" ... 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) thanks!
lowly coder <lowlycoder@huoyanjinjing.com> writes:
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.:
"float1" "float2" ...
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)
thanks!
You want the function `elem`, which returns true if the first argument is an element of a list. To use it as a managehook, you could do something like this: className <? [ "feh" , "Gitk" , "Meld" , "Kompare" , "Mbrowse" , "Zenity" ] --> doFloat -- | Return 'True' if @q@ is an element of @xs@ q <? xs = fmap (flip elem xs) q
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)
ooh, neat idea Justin. Also list comprehension example here may help http://haskell.org/haskellwiki/Xmonad/General_xmonad.hs_config_tips#Making_w... Regarding regexps and String -> Bool there's this thread and pending patch for regexps module, also Hooks.ManageHelpers in xmonad-contrib has some tools. http://article.gmane.org/gmane.comp.lang.haskell.xmonad/7058 -- wmw
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@boum.org> | gnupg key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | We're dreaming of something else. | Something more clandestine, something happier.
participants (4)
-
intrigeri@boum.org -
lowly coder -
mail@justinbogner.com -
Wirt Wolff