aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Hooks
diff options
context:
space:
mode:
authorIvan N. Veselov <veselov@gmail.com>2008-05-08 21:49:18 +0200
committerIvan N. Veselov <veselov@gmail.com>2008-05-08 21:49:18 +0200
commitaff075e22fba55a405b3a0ed2b1b095615077150 (patch)
treeccfd82ac92b91a51ca5ea13aa7ba881ef7545e2a /XMonad/Hooks
parentaa34513e8ae371dd35e2695bf6d46fb543cb94d9 (diff)
downloadXMonadContrib-aff075e22fba55a405b3a0ed2b1b095615077150.tar.gz
XMonadContrib-aff075e22fba55a405b3a0ed2b1b095615077150.tar.xz
XMonadContrib-aff075e22fba55a405b3a0ed2b1b095615077150.zip
'xmobar' function added to DynamicLog for running xmobar with some defaults
darcs-hash:20080508194918-98257-90af4d9fa986c220fbac658d04d14a8e78f231f9.gz
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r--XMonad/Hooks/DynamicLog.hs39
1 files changed, 34 insertions, 5 deletions
diff --git a/XMonad/Hooks/DynamicLog.hs b/XMonad/Hooks/DynamicLog.hs
index a7fcd83..621651d 100644
--- a/XMonad/Hooks/DynamicLog.hs
+++ b/XMonad/Hooks/DynamicLog.hs
@@ -22,6 +22,7 @@ module XMonad.Hooks.DynamicLog (
-- * Drop-in loggers
dzen,
+ xmobar,
dynamicLog,
dynamicLogDzen,
dynamicLogXmobar,
@@ -80,6 +81,9 @@ import XMonad.Hooks.ManageDocks
--
-- > main = dzen $ \conf -> xmonad $ conf { <your customizations> }
--
+-- Also you can use 'xmobar' function instead of 'dzen' in the examples above,
+-- if you have xmobar installed.
+--
-- Alternatively, you can choose among several default status bar
-- formats ('dynamicLog', 'dynamicLogDzen', 'dynamicLogXmobar', or
-- 'dynamicLogXinerama') by simply setting your logHook to the
@@ -150,7 +154,7 @@ import XMonad.Hooks.ManageDocks
-- use something like 'dynamicLogWithPP' instead.
--
-- The binding uses the XMonad.Hooks.ManageDocks module to automatically
--- handle screen placement for dzen, and enables 'mod-b' for toggling
+-- handle screen placement for dzen, and enables 'mod-b' for toggling
-- the menu bar.
--
dzen ::
@@ -163,17 +167,42 @@ dzen f = do
{ logHook = dynamicLogWithPP dzenPP
{ ppOutput = hPutStrLn h }
,layoutHook = avoidStrutsOn [U] (layoutHook defaultConfig)
- ,keys = \c -> mykeys c `M.union` keys defaultConfig c
+ ,keys = \c -> toggleStrutsKey c `M.union` keys defaultConfig c
,manageHook = manageHook defaultConfig <+> manageDocks
}
where
- mykeys (XConfig{modMask=modm}) = M.fromList
- [((modm, xK_b ), sendMessage ToggleStruts)
- ]
fg = "'#a8a3f7'" -- n.b quoting
bg = "'#3f3c6d'"
flags = "-e 'onstart=lower' -w 400 -ta l -fg " ++ fg ++ " -bg " ++ bg
+
+-- | Run xmonad with a xmobar status bar set to some nice defaults. Output
+-- is taken from the dynamicLogWithPP hook.
+--
+-- > main = xmobar xmonad
+--
+-- This works pretty much the same as 'dzen' function above
+--
+xmobar ::
+ (XConfig
+ (ModifiedLayout AvoidStruts
+ (Choose Tall (Choose (Mirror Tall) Full))) -> IO t) -> IO t
+xmobar f = do
+ h <- spawnPipe "xmobar"
+ f $ defaultConfig
+ { logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn h }
+ , layoutHook = avoidStruts $ layoutHook defaultConfig
+ , keys = \c -> toggleStrutsKey c `M.union` keys defaultConfig c
+ , manageHook = manageHook defaultConfig <+> manageDocks
+ }
+
+-- |
+-- Helper function which provides ToggleStruts keybinding
+--
+toggleStrutsKey :: XConfig t -> M.Map (KeyMask, KeySym) (X ())
+toggleStrutsKey XConfig{modMask = modm} = M.fromList
+ [ ((modm, xK_b ), sendMessage ToggleStruts) ]
+
------------------------------------------------------------------------
-- | An example log hook, which prints status information to stdout in