add higher order 'dzen' function

The intent is that:

    main = dzen xmonad

should just work, and indeed it does now, for launching a cool status
bar with minimal effort.
This commit is contained in:
Don Stewart 2007-11-07 18:31:07 +00:00
parent e34a880460
commit 901522fc10
2 changed files with 30 additions and 10 deletions

View File

@ -13,15 +13,12 @@
module XMonad.Config.Dons where module XMonad.Config.Dons where
import XMonad import XMonad
import XMonad.Config
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog
config :: XConfig donsMain :: IO ()
config = defaultConfig donsMain = dzen $ \conf -> xmonad $ conf
{ borderWidth = 2 { borderWidth = 2
, defaultGaps = [(18,0,0,0)] , terminal = "term"
, terminal = "term" , normalBorderColor = "#cccccc"
, normalBorderColor = "#cccccc" , focusedBorderColor = "#cd8b00" }
, focusedBorderColor = "#cd8b00"
, logHook = dynamicLogDzen }

View File

@ -25,6 +25,7 @@ module XMonad.Hooks.DynamicLog (
dynamicLogDzen, dynamicLogDzen,
dynamicLogWithPP, dynamicLogWithPP,
dynamicLogXinerama, dynamicLogXinerama,
dzen,
pprWindowSet, pprWindowSet,
pprWindowSetXinerama, pprWindowSetXinerama,
@ -67,9 +68,31 @@ makeSimpleDzenConfig = do
h <- spawnPipe "dzen2" h <- spawnPipe "dzen2"
return defaultConfig return defaultConfig
{ defaultGaps = [(18,0,0,0)] { defaultGaps = [(18,0,0,0)]
, logHook = dynamicLogWithPP defaultPP , logHook = dynamicLogWithPP dzenPP
{ ppOutput = hPutStrLn h } } { ppOutput = hPutStrLn h } }
-- |
--
-- Run xmonad with a dzen status bar set to some nice defaults. Output
-- it taken fromthe dynamicLogWithPP hook.
--
-- > main = dzen xmonad
--
-- The intent is that the avove config file should provide a nice status
-- bar with minimal effort.
--
dzen :: (XConfig -> IO ()) -> IO ()
dzen f = do
h <- spawnPipe ("dzen2" ++ " " ++ flags)
f $ defaultConfig
{ defaultGaps = [(18,0,0,0)]
, logHook = dynamicLogWithPP dzenPP
{ ppOutput = hPutStrLn h } }
where
fg = "'#a8a3f7'" -- n.b quoting
bg = "'#3f3c6d'"
flags = "-e '' -w 400 -ta l -fg " ++ fg ++ " -bg " ++ bg
-- | -- |
-- An example log hook, print a status bar output to stdout, in the form: -- An example log hook, print a status bar output to stdout, in the form:
-- --