xmonad-contrib-0.18.0.9: Community-maintained extensions for xmonad
Copyright(c) glasser@mit.edu
LicenseBSD
Maintainerglasser@mit.edu
Stabilitystable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Util.Dzen

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

fgColor :: String -> DzenConfig Source #

Set the foreground color.

Please be advised that fgColor and bgColor also exist in XMonad.Prompt. If you use both modules, you might have to tell the compiler which one you mean:

import XMonad.Prompt as P
import XMonad.Util.Dzen as D

dzenConfig (D.fgColor "#f0f0f0") "foobar"

bgColor :: String -> DzenConfig Source #

Set the background color.

align :: Align -> DzenConfig Source #

Set the alignment of the title (main) window content. Note that AlignRightOffset is treated as equal to AlignRight.

import XMonad.Util.Font (Align(..))

dzenConfig (align AlignLeft) "foobar"

slaveAlign :: Align -> DzenConfig Source #

Set the alignment of the slave window content. Using this option only makes sense if you also use the lineCount parameter.

lineCount :: Int -> DzenConfig Source #

Enable slave window and specify the number of lines.

Dzen can optionally draw a second window underneath the title window. By default, this window is only displayed if the mouse enters the title window. This option is only useful if the string you want to display contains more than one line.

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:

seconds 5.5

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 infixr 1 #

Left-to-right composition of Kleisli arrows.

'(bs >=> cs) a' can be understood as the do expression

do b <- bs a
   cs b