XMonad.Hooks.DynamicBars

xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | (c) Ben Boeckel 2012
License | BSD-style (as xmonad)
Maintainer | mathstuf@gmail.com
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Hooks.DynamicBars

Contents

- Usage

Description

Manage per-screen status bars.

Synopsis

- type DynamicStatusBar = ScreenId -> IO Handle
- type DynamicStatusBarCleanup = IO ()
- type DynamicStatusBarPartialCleanup = ScreenId -> IO ()
- dynStatusBarStartup :: DynamicStatusBar -> DynamicStatusBarCleanup -> X ()
- dynStatusBarStartup' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> X ()
- dynStatusBarEventHook :: DynamicStatusBar -> DynamicStatusBarCleanup -> Event -> X All
- dynStatusBarEventHook' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> Event -> X All
- multiPP :: PP -> PP -> X ()
- multiPPFormat :: (PP -> X String) -> PP -> PP -> X ()

# Usage

Provides a few helper functions to manage per-screen status bars while dynamically responding to screen changes. A startup action, event hook, and a way to separate PP styles based on the screen's focus are provided:

- The `dynStatusBarStartup` hook which initializes the status bars. The first argument is an `ScreenId -> IO Handle` which spawns a status bar on the given screen and returns the pipe which the string should be written to. The second argument is a `IO ()` to shut down all status bars. This should be placed in your `startupHook`.
- The `dynStatusBarEventHook` hook which respawns status bars when the number of screens changes. The arguments are the same as for the `dynStatusBarStartup` function. This should be placed in your `handleEventHook`.
- Each of the above functions have an alternate form (`dynStatusBarStartup'` and `dynStatusBarEventHook'`) which use a cleanup function which takes an additional `ScreenId` argument which allows for more fine-grained control for shutting down a specific screen's status bar.
- The `multiPP` function which allows for different output based on whether the screen for the status bar has focus (the first argument) or not (the second argument). This is for use in your `logHook`.
- 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 is called when the number of screens changes and on startup.

type DynamicStatusBar = ScreenId -> IO Handle #

type DynamicStatusBarCleanup = IO () #

type DynamicStatusBarPartialCleanup = ScreenId -> IO () #

dynStatusBarStartup :: DynamicStatusBar -> DynamicStatusBarCleanup -> X () #

dynStatusBarStartup' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> X () #

dynStatusBarEventHook :: DynamicStatusBar -> DynamicStatusBarCleanup -> Event -> X All #

dynStatusBarEventHook' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> Event -> X All #

multiPP #

Arguments

:: PP | The PP to use if the screen is focused
-> PP | The PP to use otherwise
-> X () |

multiPPFormat :: (PP -> X String) -> PP -> PP -> X () #