Permalink
Browse files

add patches separately and README

  • Loading branch information...
1 parent bd7482a commit cd42abd411b8c8fd0c7d1f37c812dee14de3baec @falconindy committed Jun 15, 2010
Showing with 244 additions and 0 deletions.
  1. +4 −0 README
  2. +47 −0 dwm-5.8.2-bstack.diff
  3. +193 −0 dwm-5.8.2-pertag_without_bar.diff
View
4 README
@@ -0,0 +1,4 @@
+My DWM setup. Patches are included separately. They need to be applied in order:
+
+pertag
+bstack
View
47 dwm-5.8.2-bstack.diff
@@ -0,0 +1,47 @@
+--- dwm.c-without-bstack 2010-06-15 14:09:16.938755125 -0400
++++ dwm.c 2010-06-15 14:05:39.014753744 -0400
+@@ -138,6 +138,7 @@
+ static void arrangemon(Monitor *m);
+ static void attach(Client *c);
+ static void attachstack(Client *c);
++static void bstack(Monitor *m);
+ static void buttonpress(XEvent *e);
+ static void checkotherwm(void);
+ static void cleanup(void);
+@@ -421,6 +422,36 @@
+ c->mon->stack = c;
+ }
+
++static void
++bstack(Monitor *m) {
++ int x, y, h, w, mh;
++ unsigned int i, n;
++ Client *c;
++
++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if(n == 0)
++ return;
++ /* master */
++ c = nexttiled(m->clients);
++ mh = m->mfact * m->wh;
++ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False);
++ if(--n == 0)
++ return;
++ /* tile stack */
++ x = m->wx;
++ y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
++ w = m->ww / n;
++ h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
++ if(w < bh)
++ w = m->ww;
++ for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
++ resize(c, x, y, /* remainder */ ((i + 1 == n)
++ ? m->wx + m->ww - x - 2 * c->bw : w - 2 * c->bw), h - 2 * c->bw, False);
++ if(w != m->ww)
++ x = c->x + WIDTH(c);
++ }
++}
++
+ void
+ buttonpress(XEvent *e) {
+ unsigned int i, x, click;
View
193 dwm-5.8.2-pertag_without_bar.diff
@@ -0,0 +1,193 @@
+diff -NU5 -r dwm-5.8.2/dwm.c dwm-5.8.2-pertag/dwm.c
+--- dwm-5.8.2/dwm.c 2010-06-04 12:39:15.000000000 +0200
++++ dwm-5.8.2-pertag/dwm.c 2010-06-15 17:59:56.000000000 +0200
+@@ -120,30 +120,10 @@
+ typedef struct {
+ const char *symbol;
+ void (*arrange)(Monitor *);
+ } Layout;
+
+-struct Monitor {
+- char ltsymbol[16];
+- float mfact;
+- int num;
+- int by; /* bar geometry */
+- int mx, my, mw, mh; /* screen size */
+- int wx, wy, ww, wh; /* window area */
+- unsigned int seltags;
+- unsigned int sellt;
+- unsigned int tagset[2];
+- Bool showbar;
+- Bool topbar;
+- Client *clients;
+- Client *sel;
+- Client *stack;
+- Monitor *next;
+- Window barwin;
+- const Layout *lt[2];
+-};
+-
+ typedef struct {
+ const char *class;
+ const char *instance;
+ const char *title;
+ unsigned int tags;
+@@ -276,10 +256,34 @@
+ static Window root;
+
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+
++struct Monitor {
++ char ltsymbol[16];
++ float mfact;
++ int num;
++ int by; /* bar geometry */
++ int mx, my, mw, mh; /* screen size */
++ int wx, wy, ww, wh; /* window area */
++ unsigned int seltags;
++ unsigned int sellt;
++ unsigned int tagset[2];
++ Bool showbar;
++ Bool topbar;
++ Client *clients;
++ Client *sel;
++ Client *stack;
++ Monitor *next;
++ Window barwin;
++ const Layout *lt[2];
++ int curtag;
++ int prevtag;
++ const Layout *lts[LENGTH(tags) + 1];
++ double mfacts[LENGTH(tags) + 1];
++};
++
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+
+ /* function implementations */
+ void
+@@ -1492,11 +1496,11 @@
+ void
+ setlayout(const Arg *arg) {
+ if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
+ selmon->sellt ^= 1;
+ if(arg && arg->v)
+- selmon->lt[selmon->sellt] = (Layout *)arg->v;
++ selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *)arg->v;
+ strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
+ if(selmon->sel)
+ arrange(selmon);
+ else
+ drawbar(selmon);
+@@ -1510,17 +1514,19 @@
+ if(!arg || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
+ if(f < 0.1 || f > 0.9)
+ return;
+- selmon->mfact = f;
++ selmon->mfact = selmon->mfacts[selmon->curtag] = f;
+ arrange(selmon);
+ }
+
+ void
+ setup(void) {
+ XSetWindowAttributes wa;
++ Monitor *m;
++ unsigned int i;
+
+ /* clean up any zombies immediately */
+ sigchld(0);
+
+ /* init screen */
+@@ -1553,11 +1559,25 @@
+ dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
+ dc.gc = XCreateGC(dpy, root, 0, NULL);
+ XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
+ if(!dc.font.set)
+ XSetFont(dpy, dc.gc, dc.font.xfont->fid);
+- /* init bars */
++ /* init tags */
++ for(m = mons; m; m = m->next)
++ m->curtag = m->prevtag = 1;
++ /* init mfacts */
++ for(m = mons; m; m = m->next) {
++ for(i=0; i < LENGTH(tags) + 1 ; i++) {
++ m->mfacts[i] = m->mfact;
++ }
++ }
++ /* init layouts */
++ for(m = mons; m; m = m->next) {
++ for(i=0; i < LENGTH(tags) + 1; i++) {
++ m->lts[i] = &layouts[0];
++ }
++ }
+ updatebars();
+ updatestatus();
+ /* EWMH support per view */
+ XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) netatom, NetLast);
+@@ -1684,16 +1704,29 @@
+ }
+
+ void
+ toggletag(const Arg *arg) {
+ unsigned int newtags;
++ unsigned int i;
+
+ if(!selmon->sel)
+ return;
+ newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
+ if(newtags) {
+ selmon->sel->tags = newtags;
++ if(newtags == ~0) {
++ selmon->prevtag = selmon->curtag;
++ selmon->curtag = 0;
++ }
++ if(!(newtags & 1 << (selmon->curtag - 1))) {
++ selmon->prevtag = selmon->curtag;
++ for (i=0; !(newtags & 1 << i); i++);
++ selmon->curtag = i + 1;
++ }
++ selmon->sel->tags = newtags;
++ selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
++ selmon->mfact = selmon->mfacts[selmon->curtag];
+ arrange(selmon);
+ }
+ }
+
+ void
+@@ -1957,15 +1990,31 @@
+ }
+ }
+
+ void
+ view(const Arg *arg) {
++ unsigned int i;
++
+ if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+- if(arg->ui & TAGMASK)
++ if(arg->ui & TAGMASK) {
+ selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
++ selmon->prevtag = selmon->curtag;
++ if(arg->ui == ~0)
++ selmon->curtag = 0;
++ else {
++ for (i=0; !(arg->ui & 1 << i); i++);
++ selmon->curtag = i + 1;
++ }
++ } else {
++ selmon->prevtag= selmon->curtag ^ selmon->prevtag;
++ selmon->curtag^= selmon->prevtag;
++ selmon->prevtag= selmon->curtag ^ selmon->prevtag;
++ }
++ selmon->lt[selmon->sellt]= selmon->lts[selmon->curtag];
++ selmon->mfact = selmon->mfacts[selmon->curtag];
+ arrange(selmon);
+ }
+
+ Client *
+ wintoclient(Window w) {

0 comments on commit cd42abd

Please sign in to comment.