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
import XMonad
import XMonad.Config
import XMonad.Hooks.DynamicLog
config :: XConfig
config = defaultConfig
{ borderWidth = 2
, defaultGaps = [(18,0,0,0)]
, terminal = "term"
, normalBorderColor = "#cccccc"
, focusedBorderColor = "#cd8b00"
, logHook = dynamicLogDzen }
donsMain :: IO ()
donsMain = dzen $ \conf -> xmonad $ conf
{ borderWidth = 2
, terminal = "term"
, normalBorderColor = "#cccccc"
, focusedBorderColor = "#cd8b00" }

View File

@ -25,6 +25,7 @@ module XMonad.Hooks.DynamicLog (
dynamicLogDzen,
dynamicLogWithPP,
dynamicLogXinerama,
dzen,
pprWindowSet,
pprWindowSetXinerama,
@ -67,9 +68,31 @@ makeSimpleDzenConfig = do
h <- spawnPipe "dzen2"
return defaultConfig
{ defaultGaps = [(18,0,0,0)]
, logHook = dynamicLogWithPP defaultPP
, logHook = dynamicLogWithPP dzenPP
{ 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:
--