[xmonad] xmobar

Jose A. Ortega Ruiz jao at gnu.org
Thu Nov 17 05:38:23 CET 2011

On Wed, Nov 16 2011, Marco Guidetti wrote:


> I have seen that in XMonad.Hooks.DynamicLog (xmobar) there is a way to
> do this (even if I still don't fully comprehend how to use it for the
> DynamicLog, for example).
> It's not clear to me how to use for multiple xmobar instances (as in my case).

I run two xmobar instances launched from outside xmobar, using dynamic
logs.  In my xmonad.hs i have:

  , logHook = dynamicLogString xmobarCfg >>= xmonadPropLog


  xmobarCfg = defaultPP
    { ppSep = " "
    , ppCurrent = xmobarColor defHilite ""
    , ppTitle = xmobarTitle
    , ppLayout = ppLayoutName
    , ppHidden = transNSP
    where xmobarTitle = xmobarColor defFg "" . shorten 50
          ppLayoutName x = case x of
                             "Tall" -> "·:"
                             "ThreeCol" -> "·::"
                             "Full" -> "·"
                             "Grid" -> "::"
                             _ -> x

and one of my xmobar instances has in its Commands:

    , Run XMonadLog

and XMonadLog in the template.  All that is left is a shell script
invoking the two xmobar instances, after killing any running one (for
easy restart):



    pidof xmobar && killall xmobar

    xmobar $cfg0 &
    xmobar $cfg1 &

I call this script in my .xinitrc, and every time i one to restart my
xmobars; restarting xmonad doesn't affect them.

If at first you don't succeed, try and try and try again. And then give up.
There's no point making a damn fool out of yourself.
 -Dilbert's Rules of Work, slightly paraphrased

More information about the xmonad mailing list