XMonad move windows with different title after start to a specific workspace

I want to automatically assign windows of Intellij Idea projects to specific workspaces in xmonad. I tried the following in my xmonad.hs: myManageHook = composeAll . concat $ [ [ fmap (c `isInfixOf`) title --> doShift "5:lp" | c <- myLP] , [ fmap (c `isInfixOf`) title --> doShift "2:amq-svc" | c <- myAmq] , [ fmap (c `isInfixOf`) title --> doShift "3:testfwks" | c <- myTest] ] where myLP = ["lp-intellij"] myAmq = ["msg-svc-intellij"] myTest = ["testframeworks"] However, it seems when a Intellij window is started at first the title is just "Intellij" and does not contain the projects name, so xmonad does not shift the window to the workspace. Is it possible to execute this hook when a title of a window changes, so that the projects are assigned automatically to its workspace?

On Fri, Feb 1, 2013 at 6:15 AM, Manuel Holzleitner
However, it seems when a Intellij window is started at first the title is just "Intellij" and does not contain the projects name, so xmonad does not shift the window to the workspace. Is it possible to execute this hook when a title of a window changes, so that the projects are assigned automatically to its workspace?
Hi Manuel, You might be able to get something to work by defining a handleEventHook like: import XMonad import Data.Monoid runManageHookOnPropertyEvent :: ManageHook -> Event -> X All runManageHookOnPropertyEvent mh PropertyEvent{ ev_window = w } = do windows . appEndo =<< runQuery mh w mempty runManageHookOnPropertyEvent _ _ = mempty Then you can use it in a config like: main = xmonad defaultConfig{ handleEventHook = runManageHookOnPropertyEvent (doShift "5") } I haven't tested it. It might not work for many reasons: xmonad might not get a PropertyEvent for the name change, and you might get infinite loops if the result of the manageHook resulting in events that trigger the same eventHook again. For the second issue a workaround might be to use 'modify' instead of 'windows', but then effects of the manageHook might be delayed until you do something else to make xmonad refresh (change focus, open a window). Regards, Adam
participants (2)
-
adam vogt
-
Manuel Holzleitner