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

adam vogt vogt.adam at gmail.com
Fri Feb 1 23:17:56 CET 2013


On Fri, Feb 1, 2013 at 6:15 AM, Manuel Holzleitner
<manuel.holzleitner at gmail.com> wrote:
> 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



More information about the xmonad mailing list