mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-05 06:31:53 -07:00
Merge pull request #51 from seanstrom/feature/dynamicbars-multiPPFormat
DynamicBars: Add new multiPPFormat function
This commit is contained in:
@@ -21,6 +21,7 @@ module XMonad.Hooks.DynamicBars (
|
|||||||
, dynStatusBarStartup
|
, dynStatusBarStartup
|
||||||
, dynStatusBarEventHook
|
, dynStatusBarEventHook
|
||||||
, multiPP
|
, multiPP
|
||||||
|
, multiPPFormat
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prelude
|
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 'multiPP' function which allows for different output based on whether
|
||||||
-- the screen for the status bar has focus.
|
-- 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
|
-- 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
|
-- screen to start up and returns the 'Handle' to the pipe to write to. The
|
||||||
-- 'DynamicStatusBarCleanup' argument should tear down previous instances. It
|
-- '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
|
multiPP :: PP -- ^ The PP to use if the screen is focused
|
||||||
-> PP -- ^ The PP to use otherwise
|
-> PP -- ^ The PP to use otherwise
|
||||||
-> X ()
|
-> X ()
|
||||||
multiPP focusPP unfocusPP = do
|
multiPP = multiPPFormat dynamicLogString
|
||||||
|
|
||||||
|
multiPPFormat :: (PP -> X String) -> PP -> PP -> X ()
|
||||||
|
multiPPFormat dynlStr focusPP unfocusPP = do
|
||||||
dsbInfo <- XS.get
|
dsbInfo <- XS.get
|
||||||
multiPP' dynamicLogString focusPP unfocusPP (dsbInfoHandles dsbInfo)
|
multiPP' dynlStr focusPP unfocusPP (dsbInfoHandles dsbInfo)
|
||||||
|
|
||||||
multiPP' :: (PP -> X String) -> PP -> PP -> [Handle] -> X ()
|
multiPP' :: (PP -> X String) -> PP -> PP -> [Handle] -> X ()
|
||||||
multiPP' dynlStr focusPP unfocusPP handles = do
|
multiPP' dynlStr focusPP unfocusPP handles = do
|
||||||
|
Reference in New Issue
Block a user