xmobar PipeReader doesn't work

Hi, I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions? Thanks, Jan -- jan=callcc{|jan|jan};jan.call(jan)

Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
Are you certain further data is being written to the pipe? Please include your xmonad.hs so we can see your configuration. Braden Shepherdson shepheb

* Braden Shepherdson
Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
Are you certain further data is being written to the pipe? Please include your xmonad.hs so we can see your configuration.
I think so - I tried to use 'tail -f' to watch the data, and got the
correct output.
here is the configs related to xmobar:
main = do
xmobar <- spawnPipe "xmobar"
xmonad $ defaultConfig {
...
logHook = dynamicLogWithPP $ myPP xmobar,
startupHook = myStartupHook
}
myPP h = defaultPP
{ ppCurrent = wrap "
Braden Shepherdson shepheb
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- jan=callcc{|jan|jan};jan.call(jan)

The problem is that the pipe reader doesn't appear anywhere in your template. -N On Fri, Mar 13, 2009 at 01:15:20AM +0800, Xie Hanjian wrote:
* Braden Shepherdson
[2009-03-12 13:01:51 -0400]: Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
Are you certain further data is being written to the pipe? Please include your xmonad.hs so we can see your configuration.
I think so - I tried to use 'tail -f' to watch the data, and got the correct output.
here is the configs related to xmobar:
main = do xmobar <- spawnPipe "xmobar" xmonad $ defaultConfig { ... logHook = dynamicLogWithPP $ myPP xmobar, startupHook = myStartupHook }
myPP h = defaultPP { ppCurrent = wrap "
[" "]</fc>" , ppVisible = wrap " " "</fc>" , ppHidden = wrap "" "" , ppHiddenNoWindows = \_ -> "" , ppUrgent = wrap " " "</fc>" , ppSep = " " , ppLayout = \_ -> "" , ppTitle = wrap " < " " ></fc>" , ppOutput = hPutStrLn h } and my .xmobarrc:
Config { font = "xft:Wenquanyi Bitmap Song:pixelsize=12" , bgColor = "black" , fgColor = "grey" , position = Top , lowerOnStart = True , commands = [ Run StdinReader , Run Network "eth0" ["-L","10","-H","100","--normal","#8ae234","--high","red","-t","<rx> <tx>"] 10 , Run Cpu ["-L","10","-H","60","--normal","#8ae234","--high","red","-t","CPU: <total> <user>u <system>s"] 10 , Run Memory ["-t","MEM: <usedratio>%"] 10 , Run Date "%a %b %_d %H:%M:%S" "date" 10 , Run Battery ["-t","[<left>]"] 600 , Run Mail [("mail", "~/.mail/pop3/work")] , Run Com "volumn.rb" [] "vol" 10 , Run PipeReader "/dev/shm/lrcfifo" "lrc" ] , sepChar = "%" , alignSep = "}{" , template = "%StdinReader% }{
%Mail%</fc> %cpu% %memory% %eth0% %battery% [%vol%] %date%" } Thanks, Jan
Braden Shepherdson shepheb
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- jan=callcc{|jan|jan};jan.call(jan)
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- NORBERT ZEH Canada Research Chair Associate Professor Email: nzeh@cs.dal.ca Faculty of Computer Science Phone: (902) 494-3154 Dalhousie University Fax: (902) 492-1517

* Norbert Zeh
The problem is that the pipe reader doesn't appear anywhere in your template.
Sorry I paste the wrong version of my .xmobarrc, I do have it in my
template ..
Config { font = "xft:Wenquanyi Bitmap Song:pixelsize=12"
...
, Run PipeReader "/dev/shm/lrcfifo" "lrc"
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %lrc%
-N
On Fri, Mar 13, 2009 at 01:15:20AM +0800, Xie Hanjian wrote:
* Braden Shepherdson
[2009-03-12 13:01:51 -0400]: Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
Are you certain further data is being written to the pipe? Please include your xmonad.hs so we can see your configuration.
I think so - I tried to use 'tail -f' to watch the data, and got the correct output.
here is the configs related to xmobar:
main = do xmobar <- spawnPipe "xmobar" xmonad $ defaultConfig { ... logHook = dynamicLogWithPP $ myPP xmobar, startupHook = myStartupHook }
myPP h = defaultPP { ppCurrent = wrap "
[" "]</fc>" , ppVisible = wrap " " "</fc>" , ppHidden = wrap "" "" , ppHiddenNoWindows = \_ -> "" , ppUrgent = wrap " " "</fc>" , ppSep = " " , ppLayout = \_ -> "" , ppTitle = wrap " < " " ></fc>" , ppOutput = hPutStrLn h } and my .xmobarrc:
Config { font = "xft:Wenquanyi Bitmap Song:pixelsize=12" , bgColor = "black" , fgColor = "grey" , position = Top , lowerOnStart = True , commands = [ Run StdinReader , Run Network "eth0" ["-L","10","-H","100","--normal","#8ae234","--high","red","-t","<rx> <tx>"] 10 , Run Cpu ["-L","10","-H","60","--normal","#8ae234","--high","red","-t","CPU: <total> <user>u <system>s"] 10 , Run Memory ["-t","MEM: <usedratio>%"] 10 , Run Date "%a %b %_d %H:%M:%S" "date" 10 , Run Battery ["-t","[<left>]"] 600 , Run Mail [("mail", "~/.mail/pop3/work")] , Run Com "volumn.rb" [] "vol" 10 , Run PipeReader "/dev/shm/lrcfifo" "lrc" ] , sepChar = "%" , alignSep = "}{" , template = "%StdinReader% }{
%Mail%</fc> %cpu% %memory% %eth0% %battery% [%vol%] %date%" } Thanks, Jan
Braden Shepherdson shepheb
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- jan=callcc{|jan|jan};jan.call(jan)
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
--
NORBERT ZEH Canada Research Chair Associate Professor Email: nzeh@cs.dal.ca Faculty of Computer Science Phone: (902) 494-3154 Dalhousie University Fax: (902) 492-1517
-- jan=callcc{|jan|jan};jan.call(jan)

Sorry I paste the wrong version of my .xmobarrc, I do have it in my template ..
Config { font = "xft:Wenquanyi Bitmap Song:pixelsize=12" ... , Run PipeReader "/dev/shm/lrcfifo" "lrc" ] , sepChar = "%" , alignSep = "}{" , template = "%StdinReader% }{ %lrc%
%Mail%</fc> %cpu% %memory% %eth0|wlan0% %battery% [%vol%] %date%" }
Hmm, it seems that xmobar's pipereader isn't broken per se, as I just tried it on a pipe here. Here are a few things you can do to get more info about the problem: 1) Check whether the pipe you list above actually produces any data, independently of xmobar. Eg, you should be able to just do "cat /dev/shm/lrcfifo" and see what is spits out. 2) Create a pipe somewhere with "mkfifo foo" and edit your rc file to read this pipe instead. Then fire up xmobar and in your terminal do "cat > fifo". Then start typing lines and see whether they show up in xmobar. Cheers, Norbert

* Norbert Zeh
Sorry I paste the wrong version of my .xmobarrc, I do have it in my template ..
Config { font = "xft:Wenquanyi Bitmap Song:pixelsize=12" ... , Run PipeReader "/dev/shm/lrcfifo" "lrc" ] , sepChar = "%" , alignSep = "}{" , template = "%StdinReader% }{ %lrc%
%Mail%</fc> %cpu% %memory% %eth0|wlan0% %battery% [%vol%] %date%" } Hmm, it seems that xmobar's pipereader isn't broken per se, as I just tried it on a pipe here. Here are a few things you can do to get more info about the problem:
1) Check whether the pipe you list above actually produces any data, independently of xmobar. Eg, you should be able to just do "cat /dev/shm/lrcfifo" and see what is spits out.
yes I can see data in output.
2) Create a pipe somewhere with "mkfifo foo" and edit your rc file to read this pipe instead. Then fire up xmobar and in your terminal do "cat > fifo". Then start typing lines and see whether they show up in xmobar.
Interesting. This test doesn't work here. Platform dependent? (I'm using linux x86_64 and ghc 6.8.2) Thanks, Jan
Cheers, Norbert
-- jan=callcc{|jan|jan};jan.call(jan)

2) Create a pipe somewhere with "mkfifo foo" and edit your rc file to read this pipe instead. Then fire up xmobar and in your terminal do "cat > fifo". Then start typing lines and see whether they show up in xmobar.
Interesting. This test doesn't work here. Platform dependent?
(I'm using linux x86_64 and ghc 6.8.2)
I'm also on x86_64 but am using ghc 6.8.3, and it works here. What happens when you do the above? Do you get an error or simply nothing? Also, are you running the latest xmobar (ie, darcs version)? I'm not sure whether this makes any difference, of course. -N

On 2009 Mar 13, at 10:21, Norbert Zeh wrote:
2) Create a pipe somewhere with "mkfifo foo" and edit your rc file to read this pipe instead. Then fire up xmobar and in your terminal do "cat > fifo". Then start typing lines and see whether they show up in xmobar.
Interesting. This test doesn't work here. Platform dependent?
(I'm using linux x86_64 and ghc 6.8.2)
I'm also on x86_64 but am using ghc 6.8.3, and it works here. What
This is tickling a neuron; I have a vague recollection of such a bug in 6.8.2. Try upgrading. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 2009 Mar 13, at 10:21, Norbert Zeh wrote:
I'm also on x86_64 but am using ghc 6.8.3, and it works here. What
Just nothing happen. I'm using code in darcs.
Brandon S. Allbery KF8NH
[2009-03-13 11:23:56 -0400]: This is tickling a neuron; I have a vague recollection of such a bug in 6.8.2. Try upgrading.
I'll try with 6.8.3. Thanks, Jan -- jan=callcc{|jan|jan};jan.call(jan)

Finally I got it works!
the cat > fifo problem fixed immediately after I upgrade to ghc 6.10.1
and recomplie xmobar.
but the PipeReader still stop working after read in the first line of data.
then I found this and patched the plugin:
http://www.haskell.org/haskellwiki/GHC:FAQ#When_I_open_a_FIFO_.28named_pipe.....
diff -rN old-xmobar/Plugins/PipeReader.hs new-xmobar/Plugins/PipeReader.hs
26c26
< h <- openFile p ReadMode
---
> h <- openFile p ReadWriteMode
it works perfect now.
Thanks for all :)
Cheers,
Jan
* Brandon S. Allbery KF8NH
On 2009 Mar 13, at 10:21, Norbert Zeh wrote:
2) Create a pipe somewhere with "mkfifo foo" and edit your rc file to read this pipe instead. Then fire up xmobar and in your terminal do "cat > fifo". Then start typing lines and see whether they show up in xmobar.
Interesting. This test doesn't work here. Platform dependent?
(I'm using linux x86_64 and ghc 6.8.2)
I'm also on x86_64 but am using ghc 6.8.3, and it works here. What
This is tickling a neuron; I have a vague recollection of such a bug in 6.8.2. Try upgrading.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
-- jan=callcc{|jan|jan};jan.call(jan)

you can test your xmobar at first by: cat | xmobar path/to/xmobar.config -lars On Thu, 12 Mar 2009, Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
-- jan=callcc{|jan|jan};jan.call(jan)
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Hi Lars,
Thanks for your tips, I got this:
01:19:~$ cat /dev/shm/lrcfifo|xmobar -b
<stdin>: hGetLine: end of file
Is this a haskell issue? Google told me haskell has problem like this
when read from a pipe .. How can I fix this?
Thanks,
Jan
* Chengqi(Lars) Song
you can test your xmobar at first by:
cat | xmobar path/to/xmobar.config
-lars
On Thu, 12 Mar 2009, Xie Hanjian wrote:
Hi,
I add PipeReader to my .xmobarrc, but the xmobar will always show the same string (which is read in when start xmobar), instead of showing strings write to the fifo pipe later. Any solutions?
Thanks, Jan
-- jan=callcc{|jan|jan};jan.call(jan)
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- jan=callcc{|jan|jan};jan.call(jan)

On 2009 Mar 12, at 13:23, Xie Hanjian wrote:
01:19:~$ cat /dev/shm/lrcfifo|xmobar -b <stdin>: hGetLine: end of file
Is this a haskell issue? Google told me haskell has problem like this when read from a pipe .. How can I fix this?
That's unrelated; the FIFO is behaving the way it's supposed to, the listener has to open for read+write to keep it around. xmobar does so with its PipeOpen; cat doesn't, and the shell pipe doesn't (and can't). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (5)
-
Braden Shepherdson
-
Brandon S. Allbery KF8NH
-
Chengqi(Lars) Song
-
Norbert Zeh
-
Xie Hanjian