xmonad-contrib-0.11.2: Third party extensions for xmonad

Portability | unportable
Stability | stable
Maintainer | glasser@mit.edu
Safe Haskell | None

XMonad.Util.Dzen

Contents

- Flexible interface
- Legacy interface
- Miscellaneous

Description

Handy wrapper for dzen. Requires dzen >= 0.2.4.

Synopsis

- dzenConfig :: DzenConfig -> String -> X ()
- type DzenConfig = (Int, [String]) -> X (Int, [String])
- timeout :: Rational -> DzenConfig
- font :: String -> DzenConfig
- xScreen :: ScreenId -> DzenConfig
- vCenter :: Int -> ScreenId -> DzenConfig
- hCenter :: Int -> ScreenId -> DzenConfig
- center :: Int -> Int -> ScreenId -> DzenConfig
- onCurr :: (ScreenId -> DzenConfig) -> DzenConfig
- x :: Int -> DzenConfig
- y :: Int -> DzenConfig
- addArgs :: [String] -> DzenConfig
- dzen :: String -> Int -> X ()
- dzenScreen :: ScreenId -> String -> Int -> X ()
- dzenWithArgs :: String -> [String] -> Int -> X ()
- seconds :: Rational -> Int
- chomp :: String -> String
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c

# Flexible interface

dzenConfig :: DzenConfig -> String -> X ()Source

`dzenConfig config s` will display the string `s` according to the configuration `config`. For example, to display the string `"foobar"` with all the default settings, you can simply call

     dzenConfig return "foobar"

Or, to set a longer timeout, you could use

     dzenConfig (timeout 10) "foobar"

You can combine configurations with the (>=>) operator. To display `"foobar"` for 10 seconds on the first screen, you could use

     dzenConfig (timeout 10 >=> xScreen 0) "foobar"

As a final example, you could adapt the above to display `"foobar"` for 10 seconds on the current screen with

     dzenConfig (timeout 10 >=> onCurr xScreen) "foobar"

type DzenConfig = (Int, [String]) -> X (Int, [String])Source

timeout :: Rational -> DzenConfig Source

Set the timeout, in seconds. This defaults to 3 seconds if not specified.

font :: String -> DzenConfig Source

Specify the font. Check out xfontsel to get the format of the String right; if your dzen supports xft, then you can supply that here, too.

xScreen :: ScreenId -> DzenConfig Source

Start dzen2 on a particular screen. Only works with versions of dzen that support the -xs argument.

vCenter :: Int -> ScreenId -> DzenConfig Source

`vCenter height sc` sets the configuration to have the dzen bar appear on screen `sc` with height `height`, vertically centered with respect to the actual size of that screen.

hCenter :: Int -> ScreenId -> DzenConfig Source

`hCenter width sc` sets the configuration to have the dzen bar appear on screen `sc` with width `width`, horizontally centered with respect to the actual size of that screen.

center :: Int -> Int -> ScreenId -> DzenConfig Source

`center width height sc` sets the configuration to have the dzen bar appear on screen `sc` with width `width` and height `height`, centered both horizontally and vertically with respect to the actual size of that screen.

onCurr :: (ScreenId -> DzenConfig) -> DzenConfig Source

Take a screen-specific configuration and supply it with the screen ID of the currently focused screen, according to xmonad. For example, show a 100-pixel wide bar centered within the current screen, you could use

     dzenConfig (onCurr (hCenter 100)) "foobar"

Of course, you can still combine these with (>=>); for example, to center the string `"foobar"` both horizontally and vertically in a 100x14 box using the lovely Terminus font, you could use

     terminus = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*"
     dzenConfig (onCurr (center 100 14) >=> font terminus) "foobar"

x :: Int -> DzenConfig Source

Put the top of the dzen bar at a particular pixel.

y :: Int -> DzenConfig Source

Put the left of the dzen bar at a particular pixel.

addArgs :: [String] -> DzenConfig Source

Add raw command-line arguments to the configuration. These will be passed on verbatim to dzen2. The default includes no arguments.

# Legacy interface

dzen :: String -> Int -> X ()Source

`dzen str timeout` pipes `str` to dzen2 for `timeout` microseconds. Example usage:

     dzen "Hi, mom!" (5 `seconds`)

dzenScreen :: ScreenId -> String -> Int -> X ()Source

`dzenScreen sc str timeout` pipes `str` to dzen2 for `timeout` microseconds, and on screen `sc`. Requires dzen to be compiled with Xinerama support.

dzenWithArgs :: String -> [String] -> Int -> X ()Source

`dzen str args timeout` pipes `str` to dzen2 for `timeout` seconds, passing `args` to dzen. Example usage:

     dzenWithArgs "Hi, dons!" ["-ta", "r"] (5 `seconds`)

# Miscellaneous

seconds :: Rational -> Int Source

Multiplies by ONE MILLION, for functions that take microseconds.

Use like:

     (5.5 `seconds`)

In GHC 7 and later, you must either enable the PostfixOperators extension (by adding

     {-# LANGUAGE PostfixOperators #-}

to the top of your file) or use seconds in prefix form:

     5.5 seconds

chomp :: String -> String Source

dzen wants exactly one newline at the end of its input, so this can be used for your own invocations of dzen. However, all functions in this module will call this for you.

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c

Left-to-right Kleisli composition of monads.