mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
X.H.StatusBar: Add statusBarGeneric for taffybar/trayer/stalonetray
`statusBarGeneric`: A generic `StatusBarConfig` that launches a status bar but takes a generic `X ()` logging function instead of a `PP`. This has several uses: * With `xmonadPropLog` or `xmonadPropLog'` in the logging function, a custom non-`PP`-based logger can be used for logging into an `xmobar`. * With `mempty` as the logging function, it's possible to manage a status bar that reads information from EWMH properties like `taffybar`. * With `mempty` as the logging function, any other dock like `trayer` or `stalonetray` can be managed by this module. Related: https://github.com/xmonad/xmonad-contrib/pull/463
This commit is contained in:
parent
f71095885f
commit
13b1de27a9
@ -34,6 +34,7 @@ module XMonad.Hooks.StatusBar (
|
||||
-- $availableconfigs
|
||||
statusBarProp,
|
||||
statusBarPropTo,
|
||||
statusBarGeneric,
|
||||
statusBarPipe,
|
||||
|
||||
-- * Multiple Status Bars
|
||||
@ -303,8 +304,25 @@ statusBarPropTo :: String -- ^ Property to write the string to
|
||||
-> String -- ^ The command line to launch the status bar
|
||||
-> X PP -- ^ The pretty printing options
|
||||
-> StatusBarConfig
|
||||
statusBarPropTo prop cmd pp = def
|
||||
{ sbLogHook = xmonadPropLog' prop =<< dynamicLogString =<< pp
|
||||
statusBarPropTo prop cmd pp = statusBarGeneric cmd $
|
||||
xmonadPropLog' prop =<< dynamicLogString =<< pp
|
||||
|
||||
-- | A generic 'StatusBarConfig' that launches a status bar but takes a
|
||||
-- generic @X ()@ logging function instead of a 'PP'. This has several uses:
|
||||
--
|
||||
-- * With 'xmonadPropLog' or 'xmonadPropLog'' in the logging function, a
|
||||
-- custom non-'PP'-based logger can be used for logging into an @xmobar@.
|
||||
--
|
||||
-- * With 'mempty' as the logging function, it's possible to manage a status
|
||||
-- bar that reads information from EWMH properties like @taffybar@.
|
||||
--
|
||||
-- * With 'mempty' as the logging function, any other dock like @trayer@ or
|
||||
-- @stalonetray@ can be managed by this module.
|
||||
statusBarGeneric :: String -- ^ The command line to launch the status bar
|
||||
-> X () -- ^ What and how to log to the status bar ('sbLogHook')
|
||||
-> StatusBarConfig
|
||||
statusBarGeneric cmd lh = def
|
||||
{ sbLogHook = lh
|
||||
, sbStartupHook = spawnStatusBar cmd
|
||||
, sbCleanupHook = killStatusBar cmd
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user