[xmonad] Is this a bug in ManageHook? (Spaces in composeAll)

Spencer Janssen spencerjanssen at gmail.com
Wed Sep 23 18:31:11 EDT 2009


On Wed, Sep 23, 2009 at 06:49:14PM +0200, Christian Walther wrote:
> Hi,
> 
> I'm currently using xmonad 0.8.1 compiled with ghc-6.8.3 on NetBSD
> 5.0.1 i386, after migrating from FreeBSD i386.
> After building all the software I needed/wanted, including Firefox and
> Pidgin, I noticed that not all windows where sent to the right
> workspace I configured them for. I noticed (or at least I thought)
> that some xprops changed, and I edited myManageHook to contain:
> 
> myManageHook = composeAll
>     [ title     =? "Buddy List"            --> doF (W.shift "9")
>     , className =? "Gran Paradiso"         --> doF (W.shift "8") ]
> 
> (And some more, of course...)
> 
> This has some interesting side effect, because every time I start
> either Firefox or Pidgin and their window appear on workspace 8 or 9,
> the window that has the focus is sent to exactly the same workspace,
> too.
> Commenting out both entries fixed this issue. Since they aren't needed
> (which is a perfect example of why working on a computer when being
> tired is a bad idea) this is just a minor issue. But I wonder if this
> behavior due to the nature of composeAll or something in Haskell I'm
> unfamiliar with (which is, at present, most of the language).
> 
> Regards
> Christian Walther

My guess is that multiple rules are matching on one window, causing
'doF (W.shift x)' to execute multiple times.  The first shift executed will
shift the new window, the second will shift the window that was focused before
the new window was managed.

We've noticed this issue recently in contrib, and now provide:

    -- | Move the window to a given workspace
    doShift :: WorkspaceId -> ManageHook
    doShift i = doF . W.shiftWin i =<< ask

This function is in the darcs version of xmonad, but you can also paste the
definition in your xmonad.hs.  Replace 'doF (W.shift x)' with 'doShift x'.


Cheers,
Spencer Janssen


More information about the xmonad mailing list