[xmonad] Avoiding multiple status bar processes after XMonad restart

Brandon Allbery allbery.b at gmail.com
Sun Jan 15 00:27:48 CET 2012

On Sat, Jan 14, 2012 at 18:00, Jacek Generowicz <jacek.generowicz at cern.ch>wrote:

> Brandon Allbery wrote:
> >     , startupHook = do args <- getArgs
> >                       guard (null args) $ spawn "xmobar"
> Can you point me to some documentation or examples for this? I have
> found hundreds which follow the pattern
>    main = do xmobarPipe <- spawnPipe "xmobar"
>              xmonad myConfig
>                { ...
>                , logHook = ... xmobarPipe ...
>                }

That's what I meant by the thing about pipes and dynamicLog.  If you're
using a pipe and writing to it in the logHook, then the child xmobar will
close automatically when xmonad restarts.  If you're not using that, then
you need to arrange to only start it the first time, which is what the code
I provided did.  spawnPipe is not the same thing as spawn, it creates a
communication channel and that is not useful and may be counterproductive
if you aren't communicating with the xmobar.  (In particular, if xmobar
isn't reading from the pipe because you didn't include a StdinReader in its
config, it will never notice when that pipe gets closed.)

If the difference between these still isn't clear, you may need to learn
about basic Unix concepts such as pipes.

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20120114/825803f5/attachment.htm>

More information about the xmonad mailing list