[xmonad] Allow xmonad to get input from spawned applications

Spencer Janssen sjanssen at cse.unl.edu
Sat Apr 12 21:30:21 EDT 2008


On Sat, Apr 12, 2008 at 08:26:30PM -0500, Spencer Janssen wrote:
> On Sun, Apr 13, 2008 at 11:21:04AM +1000, Ivan Miljenovic wrote:
> > I wanted to try and get a pop-up message shown on a key-press showing
> > the current mpd information.  Preferably, I'd like to keep everything
> > inside xmonad rather than relying on external scripts.
> > 
> > Now, I could have something like "mpc | head -1 | dzen"... but I
> > wanted to use something like notify-send (part of libnotify) to do so,
> > as its less obtrusive and handles non-Latin characters better (i.e.
> > using fontconfig, etc.).
> > 
> > However, since notify-send doesn't seem to want to take piped inputs,
> > I'd first have to read and parse the mpc data before I could call
> > notify-send.  This would work well... if only xmonad let me read data
> > from the processes it spawns.  As such, I think there should be a new
> > operation that lets you obtain the stdout output from the programs
> > that are spawned... something like "spawnOutput :: String -> m
> > String".
> > 
> > Is such a thing feasible/possible/good?  I _could_ just have a
> > seperate bash script to do this, but I'd like it to have my settings
> > as self-contained as possible.
> > -- 
> > Ivan Lazar Miljenovic
> 
> try this:
>     
>     do
>         h <- spawnPipe "mpd"
>         firstLine <- hGetLine h
>         doStuffWith firstLine
> 
> 
> Cheers,
> Spencer Janssen

Sorry, this is entirely wrong -- spawnPipe gives the input handle, not the
output handle.


More information about the xmonad mailing list