Can I use xmobar with DynamicLog?

I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way? Kai

On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar. Andrea

On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display. Kai

On Sun, Sep 23, 2007 at 11:48:45PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display.
What would be wrong with using a file? -- David Roundy Department of Physics Oregon State University

On Sun, Sep 23, 2007 at 02:50:46PM -0700, David Roundy wrote:
On Sun, Sep 23, 2007 at 11:48:45PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display.
What would be wrong with using a file?
It would grow. Kai

On Mon, Sep 24, 2007 at 04:55:24PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 02:50:46PM -0700, David Roundy wrote:
On Sun, Sep 23, 2007 at 11:48:45PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display.
What would be wrong with using a file?
It would grow.
Unless you did the same thing to the file that you'd do with the symlink: truncate and overwrite it. -- David Roundy Department of Physics Oregon State University

On Mon, Sep 24, 2007 at 07:58:05AM -0700, David Roundy wrote:
On Mon, Sep 24, 2007 at 04:55:24PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 02:50:46PM -0700, David Roundy wrote:
On Sun, Sep 23, 2007 at 11:48:45PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display.
What would be wrong with using a file?
It would grow.
Unless you did the same thing to the file that you'd do with the symlink: truncate and overwrite it.
Ah, I see. Hm. I was about to say that creating a symlink is an atomic operation, but now I realize that in this context it isn't, because we would need to remove the symlink first before creating a new one. But somehow it's just cool to abuse symlinks for this :-) rm -f ~/.xmonad.dynamiclog ln -s " 1 [2]<3> 4 // xterm" ~/.xmonad.dynamiclog Kai

On Mon, Sep 24, 2007 at 07:58:05AM -0700, David Roundy wrote:
On Mon, Sep 24, 2007 at 04:55:24PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 02:50:46PM -0700, David Roundy wrote:
On Sun, Sep 23, 2007 at 11:48:45PM +0200, Kai Grossjohann wrote:
On Sun, Sep 23, 2007 at 10:31:09PM +0200, Andrea Rossato wrote:
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
Maybe DynamicLog could create a symlink whose target is the string to display.
What would be wrong with using a file?
It would grow.
Unless you did the same thing to the file that you'd do with the symlink: truncate and overwrite it.
Surely this is exactly what a named pipe is for. Andrea, Why can xmobar read from a file but not a named pipe? -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/

On Mon, Sep 24, 2007 at 06:30:54PM +0100, Andy Gimblett wrote:
Andrea, Why can xmobar read from a file but not a named pipe?
To read a named pipe you must wait for output. The problem is that xombar waits for XEvents and a timer. To make things even more complicated there is the problem of threads and foreign blocks. If a foreign call is blocking, then all other Haskell thread will be blocked. To avoid that you can use operating system threads. But this means a 30% memory consumption increase. Which is a lot for a status bar. The author of the miracle of a non foreign block for waiting XEvents is Spencer, btw. In any case as far as I remember waiting for a pipe is a foreign call, and I don't want to switch to operating system threads. Not after all the noise I made to have a non blocking nextEvent... I'm open to discussion though. Cheers, Andrea

On Mon, Sep 24, 2007 at 10:23:02PM +0200, Andrea Rossato wrote:
On Mon, Sep 24, 2007 at 06:30:54PM +0100, Andy Gimblett wrote:
Andrea, Why can xmobar read from a file but not a named pipe?
To read a named pipe you must wait for output.
by the way I've tried. Attached you'll find my attempt that reads from ~/.xmobar-status. Save the file in Plugins/ In Config.hs: import Plugins.XMonadLog and change the runnableTyope to something like: runnableTypes :: (Command,(Monitors,(XLog,()))) in the configuration, commands, add: , Run XLog and %xlog% in the template. If you move around through workspaces maybe xmobar will be able to display something, but it won't last... Andrea

On Monday 24 September 2007 15:55:25 Andrea Rossato wrote:
On Mon, Sep 24, 2007 at 10:23:02PM +0200, Andrea Rossato wrote:
On Mon, Sep 24, 2007 at 06:30:54PM +0100, Andy Gimblett wrote:
Andrea, Why can xmobar read from a file but not a named pipe?
To read a named pipe you must wait for output.
by the way I've tried. Attached you'll find my attempt that reads from ~/.xmobar-status.
Save the file in Plugins/ In Config.hs: import Plugins.XMonadLog
and change the runnableTyope to something like: runnableTypes :: (Command,(Monitors,(XLog,())))
in the configuration, commands, add: , Run XLog and %xlog% in the template.
If you move around through workspaces maybe xmobar will be able to display something, but it won't last...
Andrea
Here's a hack that seems to work. Run with "xmonad | xmobar". I'll comment tomorrow on how we might accomplish this without unsafePerformIO hacks. Cheers, Spencer Janssen

On Wed, Sep 26, 2007 at 12:44:45AM -0500, Spencer Janssen wrote:
Here's a hack that seems to work. Run with "xmonad | xmobar".
I know that I'm going to spend this morning trying to figure out how you did that, instead of getting some work done, but this is extra cool! Now, I need to find a way to change my running instance of xmonad to use this new stuff.
I'll comment tomorrow on how we might accomplish this without unsafePerformIO hacks.
That's interesting indeed. Now I go reading and perhaps I'll be able to find out myself... I doubt it though. Thank you very much! Andrea

On Wed, Sep 26, 2007 at 12:44:45AM -0500, Spencer Janssen wrote:
I'll comment tomorrow on how we might accomplish this without unsafePerformIO hacks.
Hi, so, thanks to Spencer, who gave me the right directions, I came up with a nice working solution, after a small (well, not that small) API change. I've just added a PipeReader plugin, already pushed in my darcs repo: http://gorgias.mine.nu/repos/xmobar/ Screen shot: http://gorgias.mine.nu/xmobar/xmobar-logger.png To use it add such command in the command list of your configuration: Run PipeReader "/home/andrea/.xmonad.log" "xmonad" and, in the template: %xmonad% Then, in your .xprofile, something like: PIPE=$HOME/.xmonad.log rm -f $PIPE PATH=${PATH}:/sbin mkfifo -m 600 $PIPE [ -p $PIPE ] || exit xmobar & xmonad > $PIPE Let me know what you think. Cheers, Andrea

On Wed, Sep 26, 2007 at 12:44:45AM -0500, Spencer Janssen wrote:
Here's a hack that seems to work. Run with "xmonad | xmobar".
I've just added a stdin reader. You can use it also from the command line. For instance, something like: xmonad | /xmobar -t "%StdinReader%" -c '[Run StdinReader]' andrea

Andrea Rossato
On Sun, Sep 23, 2007 at 10:14:04PM +0200, Kai Grossjohann wrote:
I've just started to use xmobar. It's cool. But I still need dzen2 for the DynamicLog stuff. Is there another way?
No, for the time being. I can easily write a plugin if you use a log file, but reading a named pipe is almost impossible for xmobar.
I can not see any differences. You can always do % mkfifo myfifo % while sleep 1; do date > myfifo; done And in another shell % tail -f myfifo | dzen2 As long as xmobar can read from stdin, what is the type of the file `myfifo' is absolutely transparent to xmobar. -- c/* __o/* <\ * (__ */\ <
participants (6)
-
Andrea Rossato
-
Andy Gimblett
-
David Roundy
-
Kai Grossjohann
-
Spencer Janssen
-
Xiao-Yong Jin