[xmonad] Allow xmonad to get input from spawned applications
Spencer Janssen
sjanssen at cse.unl.edu
Sat Apr 12 21:26:30 EDT 2008
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
More information about the xmonad
mailing list