From 9e24f1964ebd6c642ebfc68f2932c363c1ec81e6 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 28 Sep 2007 14:04:32 +0200 Subject: Added a plugin to read from stdin Try it with: xmobar -t "%StdinReader%" -c '[Run StdinReader]' then start writing ;) darcs-hash:20070928120432-d6583-8b2a37548db9176c0dcfe7818c5de62722d889fb.gz --- Plugins/StdinReader.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Plugins/StdinReader.hs (limited to 'Plugins') diff --git a/Plugins/StdinReader.hs b/Plugins/StdinReader.hs new file mode 100644 index 0000000..7ad2b41 --- /dev/null +++ b/Plugins/StdinReader.hs @@ -0,0 +1,26 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Plugins.StdinReader +-- Copyright : (c) Andrea Rossato +-- License : BSD-style (see LICENSE) +-- +-- Maintainer : Andrea Rossato +-- Stability : unstable +-- Portability : unportable +-- +-- A plugin for reading from stdin +-- +----------------------------------------------------------------------------- + +module Plugins.StdinReader where + +import System.IO +import Plugins + +data StdinReader = StdinReader + deriving (Read, Show) + +instance Exec StdinReader where + start StdinReader cb = do + forever (hGetLine stdin >>= cb) + where forever a = a >> forever a -- cgit v1.2.3