Yayy! dzen2 is cool :) I've done some little changes to allow me to use't as a 
button
in the top bar. I've changed the -m flag for -l (lines instead of multiline has 
more sense
for me).

I've used mesure as stdin for dzen2 and now I've a network-meter in the top bar 
of dwm. if
you want to use it fetch the latest version of mesure from the CVS 
(cvs.nopcode.org) and
type this in your ~.xinitrc:

(
 while : ; do
 (echo eth0 && mesure -atnDKvi eth0 ) | dzen2  -x 1020 -w 80 -b 50 -l 1 -l 5
 xterm -bg black -fg gray -e sudo tcpdump -i eth0
 done
) &

The new flag for dzen2 is -b that accepts a numeric value to define the width 
of the title box.

The patch is attached.

Suggestions and ideas:
======================
 - hook SIGUSR1 and SIGUSR2 for rollup/rolldown the window
 - return value depends on the mouse button (0 = left button, 1 = middle 
button, 2 = right button) ...
 - support for wheel (progressive rollup/rolldown)

If we hook USR1 we can put a new keybinging to execute:

 pkill -USR1 dzen2

This can be used to rollup/down all the running dzen2s with a single keystroke

Nice toy!

--pancake

On Sun, 4 Mar 2007 11:37:35 +0100
Robert Manea <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> i fixed some locale related problems in dzen2. Now all characters should
> be displayed correctly if your font supports them.
> 
> You'll find the latest dzen2 version here:
>     http://gotmor.googlepages.com/dzen2-latest.tar.gz
> 
> 
> Cheers, Rob
> 


  --pancake
--- main.c.orig	2007-03-05 00:08:26.000000000 +0100
+++ main.c	2007-03-05 01:02:41.000000000 +0100
@@ -65,10 +65,15 @@
     dc.w = mw;
     dc.h = mh;
 
-    if(text)
+    if(text) {
+    	int tmp = dc.w; // hack
+	if (dc.isbutton) dc.w = dc.isbutton; // hack
         drawtext(text, dc.norm, -1);
+	dc.w = tmp; // hack
+    }
 
-    XCopyArea(dc.dpy, dc.drawable, dc.win, dc.gc, 0, 0, mw, mh, 0, 0);
+    XCopyArea(dc.dpy, dc.drawable, dc.win, dc.gc, 0, 0,
+    	(dc.isbutton)?dc.isbutton:mw, mh, 0, 0);
     XSync(dc.dpy, False);
     XFlush(dc.dpy);
 }
@@ -124,7 +129,6 @@
     }
 }
 
-
 static void
 event_loop(void *ptr) {
     XEvent ev;
@@ -171,15 +175,12 @@
                     if(ev.xbutton.window == dc.win)
                         running = False;
                     if(dc.max_lines && (ev.xbutton.window == dc.swin)) {
-                        if(ev.xbutton.button == Button1){
+                        if(ev.xbutton.button == Button1)
                             dc.issticky = (dc.issticky ? False : True);
-                        }
-                        if(ev.xbutton.button == Button4) {
+                        if(ev.xbutton.button == Button4)
                             x_scroll_window_up();
-                        }
-                        if(ev.xbutton.button == Button5) {
+                        if(ev.xbutton.button == Button5)
                             x_scroll_window_down();
-                        }
                     }
                     break;
                      /* TODO: KeyPress
@@ -254,7 +255,7 @@
 
     /* header window */
     dc.win = XCreateWindow(dc.dpy, root, 
-            dc.hx, dc.hy, mw, mh, 0,
+            dc.hx, dc.hy, dc.isbutton?dc.isbutton:mw, mh, 0,
             DefaultDepth(dc.dpy, dc.screen), CopyFromParent,
             DefaultVisual(dc.dpy, dc.screen),
             CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
@@ -296,15 +297,19 @@
     dc.hx        = 0;
     dc.hy        = 0;
     dc.hw        = 0;
+    dc.isbutton  = 0;
     dc.fnt       = FONT;
     dc.bg        = BGCOLOR;
     dc.fg        = FGCOLOR;
 
     /* cmdline args */
     for(i = 1; i < argc; i++)
-        if(!strncmp(argv[i], "-m", 3)) {
+        if(!strncmp(argv[i], "-l", 3)) {
             if(++i < argc) dc.max_lines = atoi(argv[i]);
         }
+        else if(!strncmp(argv[i], "-b", 3)) {
+            dc.isbutton = atoi(argv[++i]);
+        }
         else if(!strncmp(argv[i], "-p", 3)) {
             dc.ispersistent = True;
         }
@@ -332,7 +337,6 @@
             eprint("usage: dzen [-p] [-v] [-x <pixel>] [-y <pixel>] [-w <pixel>]\n"
                    "            [-m <lines>] [-fn <font>] [-bg <color>] [-fg <color>]\n");
 
-
     if(!XInitThreads())
         eprint("dzen: no multithreading support in xlib.\n");
     if(!setlocale(LC_ALL, "") || !XSupportsLocale())
--- dzen.h.orig	2007-03-05 00:11:37.000000000 +0100
+++ dzen.h	2007-03-05 01:22:01.000000000 +0100
@@ -61,6 +61,7 @@
     int last_line_vis;
 
     Bool issticky;
+    Bool isbutton;
     Bool ispersistent;
 }; 
 

Reply via email to