Hi,

recently yiyus wrote a lovely patch based upon my idea (in turn based
upon GNU screen's behaviour of jumping between two terminals with one
keystroke). See previous postings on the subject for more discussion.

Attached please find the patch ported to dwm-4.5.

I really think it would be very useful to have that functionality in
mainline dwm. It's extremely productive. Arg, what do you think?

Best,

[a]

-- 
. Antoni Grzymala - antoni (at) chopin.edu.pl -------------------.
| OpenPGP KeyID EB315583 available now from a keyserver near you |
| Fingerprint A819 6D2E D5EB D9E0 D2D9  7AF6 2FAF 4A11 EB31 5583 |
`----------------------------------------------------------------'
diff -Naur dwm-4.5/config.h dwm-4.5-new/config.h
--- dwm-4.5/config.h    2007-09-22 09:11:13.000000000 +0200
+++ dwm-4.5-new/config.h        2007-10-08 13:22:05.322096203 +0200
@@ -51,6 +51,7 @@
        { MODKEY,                       XK_Return,      zoom,           NULL }, 
\
        { MODKEY|ShiftMask,             XK_space,       togglefloating, NULL }, 
\
        { MODKEY|ShiftMask,             XK_c,           killclient,     NULL }, 
\
+  { MODKEY,     XK_Tab,    viewprevtag,    NULL }, \
        { MODKEY,                       XK_0,           view,           NULL }, 
\
        { MODKEY,                       XK_1,           view,           tags[0] 
}, \
        { MODKEY,                       XK_2,           view,           tags[1] 
}, \
diff -Naur dwm-4.5/dwm.c dwm-4.5-new/dwm.c
--- dwm-4.5/dwm.c       2007-09-22 09:11:13.000000000 +0200
+++ dwm-4.5-new/dwm.c   2007-10-08 13:20:48.322222876 +0200
@@ -184,6 +184,7 @@
 void updatesizehints(Client *c);
 void updatetitle(Client *c);
 void view(const char *arg);
+void viewprevtag(const char *arg);     /* views previous selected tags */
 int xerror(Display *dpy, XErrorEvent *ee);
 int xerrordummy(Display *dsply, XErrorEvent *ee);
 int xerrorstart(Display *dsply, XErrorEvent *ee);
@@ -218,6 +219,7 @@
 Bool otherwm, readin;
 Bool running = True;
 Bool *seltags;
+Bool *prevtags;
 Bool selscreen = True;
 Client *clients = NULL;
 Client *sel = NULL;
@@ -393,6 +395,7 @@
        XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
        XSync(dpy, False);
        free(seltags);
+  free(prevtags);
 }
 
 void
@@ -1468,7 +1471,9 @@
        compileregs();
        for(ntags = 0; tags[ntags]; ntags++);
        seltags = emallocz(sizeof(Bool) * ntags);
+       prevtags = emallocz(sizeof(Bool) * ntags);
        seltags[0] = True;
+       prevtags[0] = True;
 
        /* init appearance */
        dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
@@ -1838,8 +1843,10 @@
 view(const char *arg) {
        unsigned int i;
 
-       for(i = 0; i < ntags; i++)
+       for(i = 0; i < ntags; i++) {
+    prevtags[i] = seltags[i];
                seltags[i] = arg == NULL;
+  }
        i = idxoftag(arg);
        if(i >= 0 && i < ntags)
                seltags[i] = True;
@@ -1847,6 +1854,19 @@
 }
 
 void
+viewprevtag(const char *arg) {
+       unsigned int i;
+       Bool t;
+
+       for(i = 0; i < ntags; i++) {
+               t = seltags[i];
+               seltags[i] = prevtags[i];
+               prevtags[i] = t;
+       }
+       arrange();
+}
+
+void
 zoom(const char *arg) {
        Client *c;
 

Attachment: signature.asc
Description: Podpis cyfrowy :: Digital signature

Reply via email to