Fully configure xmobar

c83903f85b8d5a0f47d2afe53a9a95b3084b9819
Alexis Sellier committed ago 1 parent 0c332904
.xmobarrc +18 -1
1 +
-- Xmobar configuration
2 +
1 3
Config {
2 -
    font = "xft:DejaVu Sans Mono:size=12:antialias=true:hinting=true"
4 +
       font = "xft:DejaVu Sans Mono:size=12:antialias=true:hinting=true:hintstyle=hintslight"
5 +
     , borderColor = "black"
6 +
     , border = TopB
7 +
     , bgColor = "black"
8 +
     , fgColor = "grey"
9 +
     , position = TopW L 100
10 +
     , commands = [ Run DynNetwork [ "--template", "<dev> <tx>kB/s <rx>kB/s" ] 10
11 +
                  , Run MultiCpu   [ "--template", "<total0>% <total1>% <total2>% <total3>%", "-w", "3" ] 50
12 +
                  , Run Memory     [ "--template", "<usedratio>%", "-w", "3" ] 10
13 +
                  , Run Date       "%a %b %d %Y %H:%M:%S" "date" 10
14 +
                  , Run DiskU      [("/", "<used>/<size>")] [] 20
15 +
                  , Run StdinReader
16 +
                  ]
17 +
     , sepChar = "%"
18 +
     , alignSep = "}{"
19 +
     , template = "%StdinReader% ░ %multicpu% ░ %memory% ░ %disku% ░ %dynnetwork% }{ <fc=#aa0000>%date%</fc>"
3 20
}
.xmonad/xmonad.hs +9 -3
3 3
import XMonad.Hooks.DynamicLog
4 4
import XMonad.Hooks.ManageDocks
5 5
import XMonad.Util.Run
6 6
7 7
import System.Directory
8 +
import System.IO
8 9
import Text.Printf
9 10
import Data.Map (Map)
10 11
import qualified Data.Map as Map
11 12
12 13
main :: IO ()
13 14
main = do
14 15
    home <- getHomeDirectory
15 -
    xmonad =<< statusBar "xmobar" barConfig toggleStrutsKey desktopConfig
16 +
    xmproc <- spawnPipe "xmobar"
17 +
    xmonad $ desktopConfig
16 18
        { terminal           = "st dvtm -M"
17 19
        , focusedBorderColor = "#666666"
18 20
        , normalBorderColor  = "black"
19 21
        , borderWidth        = 2
20 22
        , handleEventHook    = mconcat [docksEventHook, handleEventHook def]
21 23
        , keys               = myKeys home
24 +
        , logHook            = dynamicLogWithPP (barConfig xmproc)
25 +
        , layoutHook         = avoidStruts $ layoutHook def
26 +
        , manageHook         = manageDocks <+> manageHook def
22 27
        }
23 28
24 -
barConfig :: PP
25 -
barConfig = xmobarPP
29 +
barConfig :: Handle -> PP
30 +
barConfig h = xmobarPP
26 31
    { ppCurrent         = xmobarColor white   black  . wrap " " " "
27 32
    , ppHiddenNoWindows = xmobarColor light   dark   . wrap " " " "
28 33
    , ppHidden          = xmobarColor light   dark   . wrap "◦" " "
29 34
    , ppUrgent          = xmobarColor black   red
30 35
    , ppWsSep           = ""
31 36
    , ppSep             = " ░ "
37 +
    , ppOutput          = hPutStrLn h
32 38
    }
33 39
  where
34 40
    red   = "red"
35 41
    white = "white"
36 42
    black = "black"