xmonad-contrib-0.11.2: Third party extensions for xmonad

Portabilityunportable
Stabilitystable
Maintainerglasser@mit.edu
Safe HaskellNone

XMonad.Util.Dzen

Contents

Description

Handy wrapper for dzen. Requires dzen >= 0.2.4.

Synopsis

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 -> DzenConfigSource

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

font :: String -> DzenConfigSource

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 -> DzenConfigSource

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

vCenter :: Int -> ScreenId -> DzenConfigSource

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 -> DzenConfigSource

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 -> DzenConfigSource

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) -> DzenConfigSource

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 -> DzenConfigSource

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

y :: Int -> DzenConfigSource

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

addArgs :: [String] -> DzenConfigSource

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 -> IntSource

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 -> StringSource

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.