dzen-utils-0.1.1: Utilities for creating inputs for dzen.

Portabilitysemi-portable (uses MPTC and type families)
Safe HaskellSafe-Infered




Functions for creating supplies and running dzen.


Simple interface



:: FilePath

Path to dzen executable, probably "dzen2"

-> [String]

Arguments for dzen.

-> Int

Delay between suplies in milliseconds. May be zero.

-> Printer a

Printer to be used.

-> IO a

Supply of inputs.

-> IO () 

Pipes a Printer to a fresh instance of dzen. It runs the following commands:

  1. Start dzen with the supplied executable and arguments.
  2. Call the supply to get an input.
  3. Apply the input to the printer.
  4. Write the printer's output to dzen's standard input.
  5. Sleeps for the specified delay using threadDelay.
  6. Go back to step 2.

You may want to use this function inside a forkIO if, for example, you're inside xmonad.

(##) :: Monad m => m a -> m b -> m (a, b)Source

This is the same as liftM2 (,), but with as a convenient operator with right infixity (the same as +++). For example, suppose you have printers

 prA :: Printer a
 prB :: Printer b
 prC :: Printer c

and supply functions

 getA :: m a
 getB :: m b
 getC :: m c

for some monad m. The final printer

 prFinal = prA +++ prB +++ prC

will be of type Printer (a,(b,c)), so you may use as its supply function

 getFinal = getA ## getB ## getC

which is of type m (a,(b,c)).

Powerful interface

createDzen :: CmdSpec -> IO HandleSource

Runs a dzen instance and returns its stdin pipe. Both stdout and stderr of the new process will be the same as this process'. The pipe returned is already line buffered.

The first string is interpreted as a shell command to start dzen. Some examples of usage:

 createDzen (RawCommand "dzen2" ["-p"])
 createDzen (ShellCommand "dzen2 -l 8 -bg #331100")



:: FilePath

dzen executable, likely "dzen2"

-> [String]

Arguments to dzen.

-> IO Handle 

Like createDzen, but never uses a shell (which is good).