Re: [dwm] question related to dzen and tail

From: Robert Manea <rob.manea_AT_googlemail.com>
Date: Mon, 14 May 2007 23:28:35 +0200

* Michael Muster (a-chopper_AT_gmx.de) wrote:
> Hello everyone,

Hello,

> Yesterday i tried to display new messages which were written into a log file.
> I tried it with dzen:
>
> (tail -n 0 -f /home/michael/irclogs/im/*bitlbee.log; sleep 10) | dzen2
> -bg darkred -fg grey80 -fn fixed -y 1009

Well, this cannot work because "tail -f" never terminates, so the sleep
won't be executed until you specifically terminate tail.

> But dzen stays at the top all the time, it would be perfect if it would
> only appear if a new line was written into the file.
>
> Any ideas how to achive this?

Dzen does not have an 'input changed' event, yet (will come with the
next release). But we can work around this limitation:

 tail -f /home/michael/irclogs/im/*bitlbee.log | while read line; do \
    echo "$line"; if [ -e /tmp/dzen2-pid ]; then kill -10 `cat /tmp/dzen2-pid`; fi; \
    done | dzen2 -p -e 'button1=lower;button3=exit;sigusr1=raise;onexit=exec:rm /tmp/dzen2-pid' & echo $! > /tmp/dzen2-pid

Clicking with mouse button1 into dzen will lower it (beneath the other
windows). As soon as tail outputs new lines dzen will raise to view.
Button3 terminates dzen.

There is also the possibility to hide dzen (like the well known
autohiding bars) with the 'hide' action. You would simply change
"button1=lower" to "button1=hide" and "sigusr1=raise" to
"sigusr1=unhide".

You could even combine both possibilities if you don't want the 1px line
dzen shows in hidden state, like "button1=hide,lower" and
"sigusr1=unhide,raise".

>
> best regards,
> Michael

Have fun, Rob.
Received on Mon May 14 2007 - 23:28:43 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:41:40 UTC