Portability | semi-portable (uses MPTC and type families) |
---|---|
Stability | experimental |
Maintainer | felipe.lessa@gmail.com |
Functions for creating supplies and running dzen
.
Simple interface
:: FilePath | Path to |
-> [String] | Arguments for |
-> Int | Delay between suplies in milliseconds. May be zero. |
-> Printer a |
|
-> IO a | Supply of inputs. |
-> IO () |
Pipes a Printer
to a fresh instance of dzen
. It runs
the following commands:
- Start
dzen
with the supplied executable and arguments. - Call the supply to get an input.
- Apply the input to the printer.
- Write the printer's output to
dzen
's standard input. - Sleeps for the specified delay using
threadDelay
. - 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")