* Jeremy O'Brien <[EMAIL PROTECTED]> [Jul 22 2007 02:14] wrote:
> I have noticed one thing that would be really really nice to have the ability 
> to do in dwm. Sometimes when I'm feeling lazy I like to use just the mouse, 
> and can obviously switch between tags very easily this way. Sometimes when 
> I'm in float mode, however, or in monocle mode with the monocle patch, I find 
> that I have to hit mod-tab to switch to a window that is being covered by 
> another, bigger window, thus killing my mouse-only experience. I understand 
> that dwm is mainly keyboard driven, but I feel it wouldn't be too difficult 
> (I could be entirely wrong on this) to possibly put in detection for a 
> wheelmouse event in the dwm bar to switch between windows mod-tab style. Is 
> anyone else interested in this?
> 

I've written two patches:
The one (windowscroll) give you the possibitlity to switch beetween
visible clients by using your mouse wheel over the window title.

The other (selecttag) introduces the possibility to select the next or
previous tag while calling selecttag("1") or selecttag("1"). In the
patch this is used to select the next/previous tag by "wheeling" over
the tag buttons in the bar. selecttag could also be used to emulate
Alt+Left/Alt+Right.

I divided this into two patches, because i know that the second is not
the way you should use tags. But IMHO it is a way tag can be used.

greetz 
  didi
diff -r 17545de77bcb dwm.h
--- a/dwm.h     Sun Jul 22 16:45:45 2007 +0200
+++ b/dwm.h     Sun Jul 22 16:50:54 2007 +0200
@@ -144,6 +144,7 @@ void toggletag(const char *arg);    /* togg
 void toggletag(const char *arg);       /* toggles sel tags with arg's index */
 void toggleview(const char *arg);      /* toggles the tag with arg's index 
(in)visible */
 void view(const char *arg);            /* views the tag with arg's index */
+void selecttag(const char *arg);        /* select next(1) / previous(-1) tag */
 
 /* util.c */
 void *emallocz(unsigned int size);     /* allocates zero-initialized memory, 
exits on error */
diff -r 17545de77bcb event.c
--- a/event.c   Sun Jul 22 16:45:45 2007 +0200
+++ b/event.c   Sun Jul 22 16:50:54 2007 +0200
@@ -135,6 +135,10 @@ buttonpress(XEvent *e) {
                                        else
                                                toggleview(buf);
                                }
+                                else if ( ev->button == Button4 )
+                                  selecttag("-1");
+                                else if ( ev->button == Button5 )
+                                  selecttag("1");
                                return;
                        }
                }
diff -r 17545de77bcb tag.c
--- a/tag.c     Sun Jul 22 16:45:45 2007 +0200
+++ b/tag.c     Sun Jul 22 16:50:54 2007 +0200
@@ -150,3 +150,20 @@ view(const char *arg) {
                seltag[i] = True;
        lt->arrange();
 }
+
+void 
+selecttag(const char *arg) {
+  int i;
+  for (i = 0; i < ntags; i++) {
+    if ( seltag[i] ) {
+      seltag[i] = False;
+      i += (arg ? atoi(arg) : 1);
+      if ( i < 0) i = ntags - 1;
+      if ( i >= ntags) i = 0;
+      seltag[i] = True;
+      lt->arrange();
+      return;
+    }
+  }
+}
+
diff -r dffe81e7e32e event.c
--- a/event.c   Sat Jul 14 21:14:15 2007 +0200
+++ b/event.c   Sun Jul 22 16:45:35 2007 +0200
@@ -144,6 +144,10 @@ buttonpress(XEvent *e) {
                                setlayout(NULL);
                                break;
                        }
+                else if ( ev->button == Button4 )
+                  focusclient("-1");
+                else if ( ev->button == Button5 )
+                  focusclient("1");
        }
        else if((c = getclient(ev->window))) {
                focus(c);

Attachment: pgpgRS9cjQHGV.pgp
Description: PGP signature

Reply via email to