[xmonad] darcs patch: add-dynamic-bars-module

Ben Boeckel mathstuf at gmail.com
Thu Mar 15 01:01:22 CET 2012

1 patch for repository http://code.haskell.org/XMonadContrib:

The Xrandr calls requires X11 1.6.0 which also causes issues in other places
in the code. I can submit these separately, but since this is not really an
official submission, I'll leave them out so they don't distract from the meat
of the patch.

There is code from adamvo's xmonad.hs (getScreens and multiPP) as well.

There are still bugs, but this is to help get some testing and other eyes
looking at it. Specifically, not all of the bars work all the time. Currently
to solve the issue, I just restart XMonad until they're all there. I'm not
sure how to best ensure that things work.

For launching the status bars, here are my implementations:

myStatusBar :: DynamicStatusBar
myStatusBar (S id) = do
    safeSpawn "xmobar" ["-x", idStr, "-C", "[ Run NamedXPropertyLog \"" ++ prop ++ "\" \"" ++ abbr ++ "\" ]"]
    spawnPipe $ "xmonadpropwrite " ++ prop
        abbr = "_XMONAD_LOG"
        prop = "_XMONAD_LOG_" ++ idStr
        idStr = show id

myStatusBarCleanup :: DynamicStatusBarCleanup
myStatusBarCleanup = safeSpawn "killall" ["xmobar"]

For this setup, a few other updates are required:

My Xrandr additions to the X11 package:

The -C option for xmobar, available here (the next branch there uses X11's
Xrandr support instead of the built-in stuff as well):

My xmobarrc is:

Config { font     = "xft:Inconsolata:pixelsize=9"
       , border   = NoBorder
       , borderColor = "black"
       , bgColor  = "black"
       , fgColor  = "grey"
       , position = TopW L 80
       , lowerOnStart = True
       , commands = [ Run Weather "KALB" ["-t","A: <tempC>°C","-L","15","-H","30","--normal","green","--high","red","--low","lightblue"] 36000
                    , Run MultiCpu ["-S","true","-t","<autototal>","-L","3","-H","40","--low","green","--normal","yellow","--high","red"] 25
                    , Run Memory ["-S","true","-t","<usedratio>","-L","20","-H","40","--low","green","--normal","yellow","--high","red"] 25
                    , Run Battery ["-S","true","-t","<left>","-L","30","-H","75","--high","green","--normal","yellow","--low", "red"] 100
                    , Run Date "%a %b %_d" "date" 36000
                    , Run Date "%H:%M" "time" 100
                    , Run Mail [ ("k","~/.local/share/mail/kitware/INBOX")
                               , ("g","~/.local/share/mail/gmail/INBOX")
                               , ("b","~/.local/share/mail/brewhouse/INBOX")
                               ] "Mail"
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%_XMONAD_LOG% }{ %multicpu% | %memory% | %battery% | %Mail% | %KALB% | <fc=#ee9a00>%date%</fc> <fc=skyblue>%time%</fc>"

Wed Mar 14 19:48:26 EDT 2012  Ben Boeckel <mathstuf at gmail.com>
  * add-dynamic-bars-module
  This adds the X.H.DynamicBars module. It allows per-screen status bars to be
  easily managed and dynamically handles the number of screens changing.
  It also adds a flag for enabling Xrandr support which bumps the minimum X11
  version to 1.6.0.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 6208 bytes
Desc: Patch preview
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20120314/f3f896f8/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/x-darcs-patch
Size: 13572 bytes
Desc: A darcs patch for your repository!
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20120314/f3f896f8/attachment-0003.bin>

More information about the xmonad mailing list