From 1452c9e273890107e4a77e30cabad2799af74247 Mon Sep 17 00:00:00 2001 From: seanstrom Date: Sun, 3 Apr 2016 16:04:49 -0700 Subject: [PATCH] add new multiPPFormat function --- XMonad/Hooks/DynamicBars.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/XMonad/Hooks/DynamicBars.hs b/XMonad/Hooks/DynamicBars.hs index 96aa0614..d97c2271 100644 --- a/XMonad/Hooks/DynamicBars.hs +++ b/XMonad/Hooks/DynamicBars.hs @@ -21,6 +21,7 @@ module XMonad.Hooks.DynamicBars ( , dynStatusBarStartup , dynStatusBarEventHook , multiPP + , multiPPFormat ) where import Prelude @@ -58,6 +59,9 @@ import qualified XMonad.Util.ExtensibleState as XS -- * The 'multiPP' function which allows for different output based on whether -- the screen for the status bar has focus. -- +-- * The 'multiPPFormat' function is the same as the 'multiPP' function, but it +-- also takes in a function that can customize the output to status bars. +-- -- The hooks take a 'DynamicStatusBar' function which is given the id of the -- screen to start up and returns the 'Handle' to the pipe to write to. The -- 'DynamicStatusBarCleanup' argument should tear down previous instances. It @@ -104,9 +108,12 @@ updateStatusBars sb cleanup = do multiPP :: PP -- ^ The PP to use if the screen is focused -> PP -- ^ The PP to use otherwise -> X () -multiPP focusPP unfocusPP = do +multiPP = multiPPFormat dynamicLogString + +multiPPFormat :: (PP -> X String) -> PP -> PP -> X () +multiPPFormat dynlStr focusPP unfocusPP = do dsbInfo <- XS.get - multiPP' dynamicLogString focusPP unfocusPP (dsbInfoHandles dsbInfo) + multiPP' dynlStr focusPP unfocusPP (dsbInfoHandles dsbInfo) multiPP' :: (PP -> X String) -> PP -> PP -> [Handle] -> X () multiPP' dynlStr focusPP unfocusPP handles = do