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

Brandon S Allbery KF8NH allbery.b at gmail.com
Mon May 2 03:20:36 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/1/11 20:28 , Michael Norrish wrote:
> 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?

I saw you asking about this in #xmonad and left a response message, but I
guess you never checked back in.  You want to do something like

    windows (W.shift "mail" w)

which reruns the layout with the specified modification.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]    allbery.b at gmail.com
system administrator  [openafs,heimdal,too many hats]                kf8nh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2+BuQACgkQIn7hlCsL25XEpQCgzyCSC1iOCaPxUEoQCM+JXde/
q9wAmwYgbnk02RlF/pGXarM9D1peg6ty
=eVRl
-----END PGP SIGNATURE-----



More information about the xmonad mailing list