[xmonad] Wanting to do a window-shift in a event handler

Michael Norrish Michael.Norrish at nicta.com.au
Mon May 2 02:28:07 CEST 2011


My situation is that I'm using Thunderbird and its External Editor plug-in to write mail.  When I invoke the external editor, it brings up an emacs window (calling through emacsclient).  I have a manage hook that puts emacs windows into a particular workspace, but I don't want e-mail composition emacs windows to go there.

I thought I could handle this by looking at an emacs window's WM_NAME in my ManageHook, but unfortunately, it seems at this point that the title is still just "emacs@<myhost>", which is not helpful.  It seems that the useful title (which is of the form "<something-or-other>.eml") gets created a little later.

So, I thought I would put in a general eventhandler to watch for a property change, and to then do the shift to the appropriate workspace.  So, I added

  handleEventHook = mappend myhandlePropEvent (handleEventHook defaultConfig)

to my modifications of the default config.

I then have

  myhandlePropEvent ev =
    case ev of
      PropertyEvent {} ->
        let w = ev_window ev
            ...

Through calls to trace, I can see that I am indeed picking up on the desired event (the change in the window's name), and I have a window (w above) to hand, but I don't know how to do things to it.  My cursory examination of the relevant APIs suggested I could do

  action <- runQuery (doShift "mail") w

giving me a handle on an Endo Windowset, but I don't know how to lift that into the X monad (where I have to eventually return $ All True).  Can I use the withWindowSet function somehow?

Michael




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20110502/f465c96a/attachment.pgp>


More information about the xmonad mailing list