7

What should my xmonad.hs file look like to correctly give workspace info to xmobar?

user66261
  • 71
  • 1
  • 2
  • 2
    The [XMonad wiki has the details](http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html)... – jasonwryan Apr 26 '14 at 23:45
  • I would still welcome an answer to this question -- the wiki contains snippets, but not a full config, so unless you already know your way around Xmonad, you're out of luck. – mitchus Jul 03 '15 at 07:15

1 Answers1

1

The most simple solution to add Xmobar is this configuration:

import XMonad
import XMonad.Hooks.DynamicLog

main = xmonad =<< xmobar def

But usually, Xmonad users prefer to adapt their desktops. This is a more popular way to add Xmobar:

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run

main = do
    -- start Xmobar process
    h <- spawnPipe "xmobar -d"
    xmonad $ def {
            -- this adds a fixup for docks
            layoutHook = avoidStruts $ layoutHook def,

            -- this adds Xmobar to Xmonad
            logHook = dynamicLogWithPP $
                    xmobarPP {
                            ppOutput = hPutStrLn h
                            },

            -- this adds a second fixup for docks
            manageHook = manageDocks <+> manageHook def
            }

Xmobar does not look nice like this, in my opinion. In most cases, people add a custom Xmobar configuration and override further PP properties that are preconfigured with xmobarPP here.