mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-18 13:43:48 -07:00
DynamicLog: statusBar'
Add a statusBar' function that accepts pretty printing options embedded in the X monad, so users can leverage dynamic printing modifiers, such as workspaceNamesPP.
This commit is contained in:
@@ -27,6 +27,7 @@ module XMonad.Hooks.DynamicLog (
|
|||||||
dzenWithFlags,
|
dzenWithFlags,
|
||||||
xmobar,
|
xmobar,
|
||||||
statusBar,
|
statusBar,
|
||||||
|
statusBar',
|
||||||
dynamicLog,
|
dynamicLog,
|
||||||
dynamicLogXinerama,
|
dynamicLogXinerama,
|
||||||
|
|
||||||
@@ -223,12 +224,25 @@ statusBar :: LayoutClass l Window
|
|||||||
-- ^ the desired key binding to toggle bar visibility
|
-- ^ the desired key binding to toggle bar visibility
|
||||||
-> XConfig l -- ^ the base config
|
-> XConfig l -- ^ the base config
|
||||||
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
statusBar cmd pp k conf = do
|
statusBar cmd pp = statusBar' cmd (return pp)
|
||||||
|
|
||||||
|
-- | Like 'statusBar' with the pretty printing options embedded in the
|
||||||
|
-- X monad. The X PP value is re-executed every time the 'logHook' runs.
|
||||||
|
-- Useful if printing options need to be modified dynamically.
|
||||||
|
statusBar' :: LayoutClass l Window
|
||||||
|
=> String -- ^ the command line to launch the status bar
|
||||||
|
-> X PP -- ^ the pretty printing options
|
||||||
|
-> (XConfig Layout -> (KeyMask, KeySym))
|
||||||
|
-- ^ the desired key binding to toggle bar visibility
|
||||||
|
-> XConfig l -- ^ the base config
|
||||||
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
|
statusBar' cmd xpp k conf = do
|
||||||
h <- spawnPipe cmd
|
h <- spawnPipe cmd
|
||||||
return $ docks $ conf
|
return $ docks $ conf
|
||||||
{ layoutHook = avoidStruts (layoutHook conf)
|
{ layoutHook = avoidStruts (layoutHook conf)
|
||||||
, logHook = do
|
, logHook = do
|
||||||
logHook conf
|
logHook conf
|
||||||
|
pp <- xpp
|
||||||
dynamicLogWithPP pp { ppOutput = hPutStrLn h }
|
dynamicLogWithPP pp { ppOutput = hPutStrLn h }
|
||||||
, keys = liftA2 M.union keys' (keys conf)
|
, keys = liftA2 M.union keys' (keys conf)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user