Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* [First Commit] Added dwm config, files, patches.

    * Added dotdwm as in .dwm
        * dotdwm includes dwm-start and dwm-status script
    * Added xinitrc as in .xinitrc
  • Loading branch information...
commit f308637a603b4052ddf39965dbc261c22b07f077 1 parent cb0788e
@gnusosa authored
View
197 01-dwm-6.0-statuscolors.diff
@@ -0,0 +1,197 @@
+--- dwm-5.9/dwm.c 2011-07-10 16:24:25.000000000 -0400
++++ dwm-5.9-colors/dwm.c 2011-08-18 02:07:20.788935100 -0400
+@@ -48,6 +48,7 @@
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define MAX(A, B) ((A) > (B) ? (A) : (B))
+ #define MIN(A, B) ((A) < (B) ? (A) : (B))
++#define MAXCOLORS 21
+ #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+ #define HEIGHT(X) ((X)->h + 2 * (X)->bw)
+@@ -97,9 +98,8 @@ struct Client {
+
+ typedef struct {
+ int x, y, w, h;
+- unsigned long norm[ColLast];
+- unsigned long sel[ColLast];
+- Drawable drawable;
++ unsigned long colors[MAXCOLORS][ColLast];
++ Drawable drawable;
+ GC gc;
+ struct {
+ int ascent;
+@@ -175,8 +175,9 @@ static void die(const char *errstr, ...)
+ static Monitor *dirtomon(int dir);
+ static void drawbar(Monitor *m);
+ static void drawbars(void);
+-static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
+-static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
++static void drawcoloredtext(char *text);
++static void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]);
++static void drawtext(const char *text, unsigned long col[ColLast], Bool pad);
+ static void enternotify(XEvent *e);
+ static void expose(XEvent *e);
+ static void focus(Client *c);
+@@ -736,14 +737,13 @@ drawbar(Monitor *m) {
+ dc.x = 0;
+ for(i = 0; i < LENGTH(tags); i++) {
+ dc.w = TEXTW(tags[i]);
+- col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
+- drawtext(tags[i], col, urg & 1 << i);
+- drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+- occ & 1 << i, urg & 1 << i, col);
++ col = dc.colors[ (m->tagset[m->seltags] & 1 << i ? 1:(urg & 1 << i ? 2:0))];
++ drawtext(tags[i], col, True);
++ drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col);
+ dc.x += dc.w;
+ }
+ dc.w = blw = TEXTW(m->ltsymbol);
+- drawtext(m->ltsymbol, dc.norm, False);
++ drawtext(m->ltsymbol, dc.colors[0], True);
+ dc.x += dc.w;
+ x = dc.x;
+ if(m == selmon) { /* status is only drawn on selected monitor */
+@@ -753,19 +753,19 @@ drawbar(Monitor *m) {
+ dc.x = x;
+ dc.w = m->ww - x;
+ }
+- drawtext(stext, dc.norm, False);
++ drawcoloredtext(stext);
+ }
+ else
+ dc.x = m->ww;
+ if((dc.w = dc.x - x) > bh) {
+ dc.x = x;
+ if(m->sel) {
+- col = m == selmon ? dc.sel : dc.norm;
+- drawtext(m->sel->name, col, False);
+- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
++ col = m == selmon ? dc.colors[1] : dc.colors[0];
++ drawtext(m->sel->name, col, True);
++ drawsquare(m->sel->isfixed, m->sel->isfloating, col);
+ }
+ else
+- drawtext(NULL, dc.norm, False);
++ drawtext(NULL, dc.colors[0], False);
+ }
+ XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
+ XSync(dpy, False);
+@@ -780,10 +780,39 @@ drawbars(void) {
+ }
+
+ void
+-drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
+- int x;
++drawcoloredtext(char *text) {
++ Bool first=True;
++ char *buf = text, *ptr = buf, c = 1;
++ unsigned long *col = dc.colors[0];
++ int i, ox = dc.x;
++
++ while( *ptr ) {
++ for( i = 0; *ptr < 0 || *ptr > NUMCOLORS; i++, ptr++);
++ if( !*ptr ) break;
++ c=*ptr;
++ *ptr=0;
++ if( i ) {
++ dc.w = selmon->ww - dc.x;
++ drawtext(buf, col, first);
++ dc.x += textnw(buf, i) + textnw(&c,1);
++ if( first ) dc.x += ( dc.font.ascent + dc.font.descent ) / 2;
++ first = False;
++ } else if( first ) {
++ ox = dc.x += textnw(&c,1);
++ }
++ *ptr = c;
++ col = dc.colors[ c-1 ];
++ buf = ++ptr;
++ }
++ if( !first ) dc.x-=(dc.font.ascent+dc.font.descent)/2;
++ drawtext(buf, col, True);
++ dc.x = ox;
++}
+
+- XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
++void
++drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]) {
++ int x;
++ XSetForeground(dpy, dc.gc, col[ ColFG ]);
+ x = (dc.font.ascent + dc.font.descent + 2) / 4;
+ if(filled)
+ XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1);
+@@ -792,17 +821,17 @@ drawsquare(Bool filled, Bool empty, Bool
+ }
+
+ void
+-drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
++drawtext(const char *text, unsigned long col[ColLast], Bool pad) {
+ char buf[256];
+ int i, x, y, h, len, olen;
+
+- XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]);
++ XSetForeground(dpy, dc.gc, col[ ColBG ]);
+ XFillRectangle(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.w, dc.h);
+ if(!text)
+ return;
+ olen = strlen(text);
+- h = dc.font.ascent + dc.font.descent;
+- y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
++ h = pad ? (dc.font.ascent + dc.font.descent) : 0;
++ y = dc.y + ((dc.h + dc.font.ascent - dc.font.descent) / 2);
+ x = dc.x + (h / 2);
+ /* shorten text if necessary */
+ for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; len--);
+@@ -811,7 +840,7 @@ drawtext(const char *text, unsigned long
+ memcpy(buf, text, len);
+ if(len < olen)
+ for(i = len; i && i > len - 3; buf[--i] = '.');
+- XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
++ XSetForeground(dpy, dc.gc, col[ ColFG ]);
+ if(dc.font.set)
+ XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
+ else
+@@ -861,7 +890,7 @@ focus(Client *c) {
+ detachstack(c);
+ attachstack(c);
+ grabbuttons(c, True);
+- XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
++ XSetWindowBorder(dpy, c->win, dc.colors[1][ColBorder]);
+ setfocus(c);
+ }
+ else
+@@ -1137,7 +1166,7 @@ manage(Window w, XWindowAttributes *wa)
+ }
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+- XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
++ XSetWindowBorder(dpy, w, dc.colors[0][ColBorder]);
+ configure(c); /* propagates border_width, if size doesn't change */
+ updatesizehints(c);
+ updatewmhints(c);
+@@ -1550,12 +1579,11 @@ setup(void) {
+ cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
+ cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
+ /* init appearance */
+- dc.norm[ColBorder] = getcolor(normbordercolor);
+- dc.norm[ColBG] = getcolor(normbgcolor);
+- dc.norm[ColFG] = getcolor(normfgcolor);
+- dc.sel[ColBorder] = getcolor(selbordercolor);
+- dc.sel[ColBG] = getcolor(selbgcolor);
+- dc.sel[ColFG] = getcolor(selfgcolor);
++ for(int i=0; i<NUMCOLORS; i++) {
++ dc.colors[i][ColBorder] = getcolor( colors[i][ColBorder] );
++ dc.colors[i][ColFG] = getcolor( colors[i][ColFG] );
++ dc.colors[i][ColBG] = getcolor( colors[i][ColBG] );
++ }
+ 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);
+@@ -1716,7 +1744,7 @@ unfocus(Client *c, Bool setfocus) {
+ if(!c)
+ return;
+ grabbuttons(c, False);
+- XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
++ XSetWindowBorder(dpy, c->win, dc.colors[0][ColBorder]);
+ if(setfocus)
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ }
View
244 02-dwm-6.0-pertag2.diff
@@ -0,0 +1,244 @@
+--- dwm.c.orig 2012-03-26 19:03:55.060707114 +0200
++++ dwm.c 2012-03-26 19:06:25.099846211 +0200
+@@ -126,8 +126,6 @@ typedef struct {
+
+ struct Monitor {
+ char ltsymbol[16];
+- float mfact;
+- int nmaster;
+ int num;
+ int by; /* bar geometry */
+ int mx, my, mw, mh; /* screen size */
+@@ -143,9 +141,21 @@ struct Monitor {
+ Monitor *next;
+ Window barwin;
+ const Layout *lt[2];
++ int curtag;
++ int prevtag;
++ const Layout **lts;
++ double *mfacts;
++ int *nmasters;
+ };
+
+ typedef struct {
++ const char *name;
++ const Layout *layout;
++ float mfact;
++ int nmaster;
++} Tag;
++
++typedef struct {
+ const char *class;
+ const char *instance;
+ const char *title;
+@@ -252,6 +262,7 @@ static int xerror(Display *dpy, XErrorEv
+ static int xerrordummy(Display *dpy, XErrorEvent *ee);
+ static int xerrorstart(Display *dpy, XErrorEvent *ee);
+ static void zoom(const Arg *arg);
++static void bstack(Monitor *m);
+
+ /* variables */
+ static const char broken[] = "broken";
+@@ -442,7 +453,7 @@ buttonpress(XEvent *e) {
+ if(ev->window == selmon->barwin) {
+ i = x = 0;
+ do
+- x += TEXTW(tags[i]);
++ x += TEXTW(tags[i].name);
+ while(ev->x >= x && ++i < LENGTH(tags));
+ if(i < LENGTH(tags)) {
+ click = ClkTagBar;
+@@ -514,6 +525,9 @@ cleanupmon(Monitor *mon) {
+ }
+ XUnmapWindow(dpy, mon->barwin);
+ XDestroyWindow(dpy, mon->barwin);
++ free(mon->mfacts);
++ free(mon->nmasters);
++ free(mon->lts);
+ free(mon);
+ }
+
+@@ -647,17 +661,31 @@ configurerequest(XEvent *e) {
+ Monitor *
+ createmon(void) {
+ Monitor *m;
++ int i, numtags = LENGTH(tags) + 1;
+
+ if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
++ if(!(m->mfacts = calloc(numtags, sizeof(double))))
++ die("fatal: could not malloc() %u bytes\n", sizeof(double) * numtags);
++ if(!(m->nmasters = calloc(numtags, sizeof(int))))
++ die("fatal: could not malloc() %u bytes\n", sizeof(int) * numtags);
++ if(!(m->lts = calloc(numtags, sizeof(Layout *))))
++ die("fatal: could not malloc() %u bytes\n", sizeof(Layout *) * numtags);
+ m->tagset[0] = m->tagset[1] = 1;
+- m->mfact = mfact;
+- m->nmaster = nmaster;
++ m->mfacts[0] = mfact;
++ m->nmasters[0] = nmaster;
++ m->lts[0] = &layouts[0];
+ m->showbar = showbar;
+ m->topbar = topbar;
+- m->lt[0] = &layouts[0];
++ m->curtag = m->prevtag = 1;
++ for(i = 1; i < numtags; i++) {
++ m->mfacts[i] = tags[i - 1].mfact < 0 ? mfact : tags[i - 1].mfact;
++ m->nmasters[i] = tags[i - 1].nmaster < 0 ? nmaster : tags[i - 1].nmaster;
++ m->lts[i] = tags[i - 1].layout;
++ }
++ m->lt[0] = m->lts[m->curtag];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+- strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++ strncpy(m->ltsymbol, m->lt[0]->symbol, sizeof m->ltsymbol);
+ return m;
+ }
+
+@@ -730,9 +758,9 @@ drawbar(Monitor *m) {
+ }
+ dc.x = 0;
+ for(i = 0; i < LENGTH(tags); i++) {
+- dc.w = TEXTW(tags[i]);
++ dc.w = TEXTW(tags[i].name);
+ col = dc.colors[ (m->tagset[m->seltags] & 1 << i ? 1:(urg & 1 << i ? 2:0))];
+- drawtext(tags[i], col, True);
++ drawtext(tags[i].name, col, True);
+ drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col);
+ dc.x += dc.w;
+ }
+@@ -1057,7 +1085,7 @@ grabkeys(void) {
+
+ void
+ incnmaster(const Arg *arg) {
+- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
++ selmon->nmasters[selmon->curtag] = MAX(selmon->nmasters[selmon->curtag] + arg->i, 0);
+ arrange(selmon);
+ }
+
+@@ -1587,7 +1615,7 @@ 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);
+@@ -1602,10 +1630,10 @@ setmfact(const Arg *arg) {
+
+ if(!arg || !selmon->lt[selmon->sellt]->arrange)
+ return;
+- f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
++ f = arg->f < 1.0 ? arg->f + selmon->mfacts[selmon->curtag] : arg->f - 1.0;
+ if(f < 0.1 || f > 0.9)
+ return;
+- selmon->mfact = f;
++ selmon->mfacts[selmon->curtag] = f;
+ arrange(selmon);
+ }
+
+@@ -1738,13 +1766,13 @@ tile(Monitor *m) {
+ if(n == 0)
+ return;
+
+- if(n > m->nmaster)
+- mw = m->nmaster ? m->ww * m->mfact : 0;
++ if(n > m->nmasters[m->curtag])
++ mw = m->nmasters[m->curtag] ? m->ww * m->mfacts[m->curtag] : 0;
+ else
+ mw = m->ww;
+ for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+- if(i < m->nmaster) {
+- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
++ if(i < m->nmasters[m->curtag]) {
++ h = (m->wh - my) / (MIN(n, m->nmasters[m->curtag]) - i);
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+ my += HEIGHT(c);
+ }
+@@ -1776,13 +1804,24 @@ togglefloating(const Arg *arg) {
+
+ void
+ toggletag(const Arg *arg) {
+- unsigned int newtags;
++ unsigned int i, newtags;
+
+ 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];
+ focus(NULL);
+ arrange(selmon);
+ }
+@@ -2071,11 +2110,26 @@ updatewmhints(Client *c) {
+
+ 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];
+ focus(NULL);
+ arrange(selmon);
+ }
+@@ -2154,6 +2208,32 @@ zoom(const Arg *arg) {
+ pop(c);
+ }
+
++void
++bstack(Monitor *m) {
++ unsigned int i, n, w, mh, mx, tx;
++ Client *c;
++
++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if(n == 0)
++ return;
++
++ if(n > m->nmasters[m->curtag])
++ mh = m->nmasters[m->curtag] ? m->wh * m->mfacts[m->curtag] : 0;
++ else
++ mh = m->wh;
++ for(i = mx = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ if(i < m->nmasters[m->curtag]) {
++ w = (m->ww - mx) / (MIN(n, m->nmasters[m->curtag]) - i);
++ resize(c, m->wx + mx, m->wy, w - (2*c->bw), mh - (2*c->bw), False);
++ mx += WIDTH(c);
++ }
++ else {
++ w = (m->ww - tx) / (n - i);
++ resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - (2*c->bw), False);
++ tx += WIDTH(c);
++ }
++}
++
+ int
+ main(int argc, char *argv[]) {
+ if(argc == 2 && !strcmp("-v", argv[1]))
View
81 03-dwm-6.0-scratchpad-stay.diff
@@ -0,0 +1,81 @@
+--- dwm.c.orig 2011-12-19 18:19:17.275713017 +0100
++++ dwm.c 2011-12-19 18:20:58.811158588 +0100
+@@ -240,6 +240,7 @@ static int textnw(const char *text, unsi
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglescratch(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, Bool setfocus);
+@@ -298,6 +299,8 @@ static Window root;
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+
++static unsigned int scratchpadtag = 1 << LENGTH(tags); /* This tag specially for you, Scratchpad. */
++
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+
+@@ -1170,6 +1173,16 @@ manage(Window w, XWindowAttributes *wa)
+ && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
+ c->bw = borderpx;
+
++ if(strcmp(c->name, scratchpadname) == 0) {
++ c->tags = scratchpadtag;
++ c->isfloating = True;
++ c->x = (c->mon->mw - c->w) - 10;
++ c->y = 20;
++ c->mon->tagset[c->mon->seltags] |= c->tags;
++ } else { /* make sure non-scratchpads stay out of scratchpadtag */
++ c->tags &= TAGMASK;
++ }
++
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+ XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
+@@ -1775,6 +1788,25 @@ togglefloating(const Arg *arg) {
+ }
+
+ void
++togglescratch(const Arg *arg) {
++ Client *c = NULL;
++ unsigned int found = 0;
++ /* check if a scratchpad is already there in scratchpadtag */
++ for(c = selmon->clients; c && !(found = c->tags & scratchpadtag); c = c->next);
++ if(!found) { /* not found: launch it and put it in its tag (see manage()) */
++ spawn(arg);
++ return;
++ }
++ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchpadtag;
++ if(newtagset) {
++ selmon->tagset[selmon->seltags] = newtagset;
++ arrange(selmon);
++ }
++ focus(c);
++}
++
++
++void
+ toggletag(const Arg *arg) {
+ unsigned int i, newtags;
+
+@@ -2083,8 +2115,9 @@ updatewmhints(Client *c) {
+ void
+ view(const Arg *arg) {
+ unsigned int i;
++ unsigned int stag = selmon->tagset[selmon->seltags] & scratchpadtag;
+
+- if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
++ if((arg->ui & TAGMASK) == (selmon->tagset[selmon->seltags] & TAGMASK))
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ if(arg->ui & TAGMASK) {
+@@ -2101,6 +2134,7 @@ view(const Arg *arg) {
+ selmon->curtag^= selmon->prevtag;
+ selmon->prevtag= selmon->curtag ^ selmon->prevtag;
+ }
++ selmon->tagset[selmon->seltags] |= stag;
+ selmon->lt[selmon->sellt]= selmon->lts[selmon->curtag];
+ focus(NULL);
+ arrange(selmon);
View
85 04-dwm-6.0-xbm_layout_icons.diff
@@ -0,0 +1,85 @@
+--- dwm.c.orig 2012-04-29 19:07:00.000000000 +0200
++++ dwm.c 2012-04-29 19:07:40.237787666 +0200
+@@ -120,10 +120,15 @@ typedef struct {
+ } Key;
+
+ typedef struct {
++ const char *icon;
+ const char *symbol;
+ void (*arrange)(Monitor *);
+ } Layout;
+
++typedef struct {
++ const char *icon;
++} MonocleNumberedIcon;
++
+ struct Monitor {
+ char ltsymbol[16];
+ int num;
+@@ -188,6 +193,7 @@ static void die(const char *errstr, ...)
+ static Monitor *dirtomon(int dir);
+ static void drawbar(Monitor *m);
+ static void drawbars(void);
++static void drawicon(const char *file, unsigned long col[ColLast]);
+ static void drawcoloredtext(char *text);
+ static void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]);
+ static void drawtext(const char *text, unsigned long col[ColLast], Bool pad);
+@@ -750,7 +756,7 @@ dirtomon(int dir) {
+ void
+ drawbar(Monitor *m) {
+ int x;
+- unsigned int i, occ = 0, urg = 0;
++ unsigned int i, occ = 0, urg = 0, n = 0;
+ unsigned long *col;
+ Client *c;
+
+@@ -767,8 +773,26 @@ drawbar(Monitor *m) {
+ drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col);
+ dc.x += dc.w;
+ }
+- dc.w = blw = TEXTW(m->ltsymbol);
+- drawtext(m->ltsymbol, dc.colors[0], True);
++ blw = TEXTW(m->ltsymbol);
++
++ if(useicons) {
++ dc.w = dc.h;
++ if(selmon->lt[selmon->sellt]->arrange == monocle) {
++ for(c = m->clients; c; c = c->next)
++ if(ISVISIBLE(c))
++ n++;
++ if(n < LENGTH(monoclenumberedicons))
++ drawicon(monoclenumberedicons[n].icon, dc.colors[0]);
++ else
++ drawicon(m->lt[m->sellt]->icon, dc.colors[0]);
++ }
++ else
++ drawicon(m->lt[m->sellt]->icon, dc.colors[0]);
++ }
++ else {
++ dc.w = blw;
++ drawtext(m->ltsymbol, dc.colors[0], False);
++ }
+ dc.x += dc.w;
+ x = dc.x;
+ if(m == selmon) { /* status is only drawn on selected monitor */
+@@ -835,6 +859,20 @@ drawcoloredtext(char *text) {
+ }
+
+ void
++drawicon(const char *file, unsigned long col[ColLast]) {
++ Pixmap icon;
++ int px, py;
++ unsigned int pw, ph;
++ icon = XCreatePixmap(dpy, dc.drawable, dc.h, dc.h, 1);
++ XReadBitmapFile(dpy, dc.drawable, file, &pw, &ph, &icon, &px, &py);
++ XSetForeground(dpy, dc.gc, col[ColBG]);
++ XFillRectangle(dpy, dc.drawable, dc.gc, dc.x, 0, dc.h, dc.h);
++ XSetForeground(dpy, dc.gc, col[ColFG]);
++ XSetBackground(dpy, dc.gc, col[ColBG]);
++ XCopyPlane(dpy, icon, dc.drawable, dc.gc, px, py, pw, ph, dc.x, dc.h/2-ph/2+py, 1);
++}
++
++void
+ drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]) {
+ int x;
+ XSetForeground(dpy, dc.gc, col[ ColFG ]);
View
11 05-dwm-6.0-cflags.diff
@@ -0,0 +1,11 @@
+--- config.mk.orig 2011-07-10 22:24:25.000000000 +0200
++++ config.mk 2011-07-11 18:40:23.073559357 +0200
+@@ -21,7 +21,7 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
+ # flags
+ CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+ #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
+-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
++CFLAGS = -march=native -std=c99 -pedantic -Wall -O2 ${INCS} ${CPPFLAGS}
+ #LDFLAGS = -g ${LIBS}
+ LDFLAGS = -s ${LIBS}
+
View
25 06-dwm-6.0-monocle_no_borders.diff
@@ -0,0 +1,25 @@
+--- dwm.c.o 2012-03-26 22:00:54.000000000 +0200
++++ dwm.c 2012-03-26 22:05:38.809587732 +0200
+@@ -939,7 +939,8 @@ focus(Client *c) {
+ detachstack(c);
+ attachstack(c);
+ grabbuttons(c, True);
+- XSetWindowBorder(dpy, c->win, dc.colors[1][ColBorder]);
++ if(c->mon->lt[c->mon->sellt]->arrange != monocle || c->isfloating)
++ XSetWindowBorder(dpy, c->win, dc.colors[1][ColBorder]);
+ setfocus(c);
+ }
+ else
+@@ -1293,8 +1294,10 @@ monocle(Monitor *m) {
+ n++;
+ if(n > 0) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+- for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
+- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
++ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
++ resize(c, m->wx - c->bw, m->wy - c->bw, m->ww, m->wh, False);
++ XSetWindowBorder(dpy, c->win, dc.colors[0][ColBG]);
++ }
+ }
+
+ void
View
52 07-dwm-6.0-centred-floating.diff
@@ -0,0 +1,52 @@
+--- dwm.c.orig 2012-04-03 07:46:37.601960478 +0200
++++ dwm.c 2012-04-03 07:47:24.718558096 +0200
+@@ -91,7 +91,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+ unsigned int tags;
+- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize, iscentred;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+@@ -162,6 +162,7 @@ typedef struct {
+ const char *title;
+ unsigned int tags;
+ Bool isfloating;
++ Bool iscentred;
+ int monitor;
+ } Rule;
+
+@@ -318,6 +319,7 @@ applyrules(Client *c) {
+
+ /* rule matching */
+ c->isfloating = c->tags = 0;
++ c->iscentred = 1;
+ XGetClassHint(dpy, c->win, &ch);
+ class = ch.res_class ? ch.res_class : broken;
+ instance = ch.res_name ? ch.res_name : broken;
+@@ -329,6 +331,7 @@ applyrules(Client *c) {
+ && (!r->instance || strstr(instance, r->instance)))
+ {
+ c->isfloating = r->isfloating;
++ c->iscentred = r->iscentred;
+ c->tags |= r->tags;
+ for(m = mons; m && m->num != r->monitor; m = m->next);
+ if(m)
+@@ -1211,8 +1214,14 @@ manage(Window w, XWindowAttributes *wa)
+ applyrules(c);
+ }
+ /* geometry */
+- c->x = c->oldx = wa->x;
+- c->y = c->oldy = wa->y;
++ if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && c->iscentred) {
++ c->x = c->oldx = c->mon->wx + (c->mon->ww / 2 - wa->width / 2);
++ c->y = c->oldy = c->mon->wy + (c->mon->wh / 2 - wa->height / 2);
++ }
++ else {
++ c->x = c->oldx = wa->x;
++ c->y = c->oldy = wa->y;
++ }
+ c->w = c->oldw = wa->width;
+ c->h = c->oldh = wa->height;
+ c->oldbw = wa->border_width;
View
46 08-dwm-6.0-save_floats.diff
@@ -0,0 +1,46 @@
+URL: http://dwm.suckless.org/patches/historical/save_floats
+This patch saves size and position of every floating window before it is forced
+into tiled mode. If the window is made floating again, the old dimensions will
+be restored.
+
+diff -r 6f54bd1ef439 dwm.c
+--- a/dwm.c Wed Jan 04 13:30:12 2012 +0100
++++ b/dwm.c Sun Feb 12 09:32:23 2012 +0100
+@@ -86,6 +86,7 @@
+ char name[256];
+ float mina, maxa;
+ int x, y, w, h;
++ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
+ int oldx, oldy, oldw, oldh;
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+@@ -1149,6 +1150,10 @@
+ updatewindowtype(c);
+ updatesizehints(c);
+ updatewmhints(c);
++ c->sfx = c->x;
++ c->sfy = c->y;
++ c->sfw = c->w;
++ c->sfh = c->h;
+ XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
+ grabbuttons(c, False);
+ if(!c->isfloating)
+@@ -1741,8 +1746,16 @@
+ return;
+ selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+ if(selmon->sel->isfloating)
+- resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+- selmon->sel->w, selmon->sel->h, False);
++ /*restore last known float dimensions*/
++ resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
++ selmon->sel->sfw, selmon->sel->sfh, False);
++ else {
++ /*save last known float dimensions*/
++ selmon->sel->sfx = selmon->sel->x;
++ selmon->sel->sfy = selmon->sel->y;
++ selmon->sel->sfw = selmon->sel->w;
++ selmon->sel->sfh = selmon->sel->h;
++ }
+ arrange(selmon);
+ }
+
View
607 09-dwm-6.0-systray.diff
@@ -0,0 +1,607 @@
+--- dwm.c.orig 2012-04-05 16:37:04.190034330 +0200
++++ dwm.c 2012-04-05 16:39:42.670832293 +0200
+@@ -56,12 +56,30 @@
+ #define TAGMASK ((1 << LENGTH(tags)) - 1)
+ #define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height)
+
++#define SYSTEM_TRAY_REQUEST_DOCK 0
++#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
++
++/* XEMBED messages */
++#define XEMBED_EMBEDDED_NOTIFY 0
++#define XEMBED_WINDOW_ACTIVATE 1
++#define XEMBED_FOCUS_IN 4
++#define XEMBED_MODALITY_ON 10
++
++#define XEMBED_MAPPED (1 << 0)
++#define XEMBED_WINDOW_ACTIVATE 1
++#define XEMBED_WINDOW_DEACTIVATE 2
++
++#define VERSION_MAJOR 0
++#define VERSION_MINOR 0
++#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
++
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
+-enum { NetSupported, NetWMName, NetWMState,
+- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+- NetWMWindowTypeDialog, NetLast }; /* EWMH atoms */
++enum { NetSupported, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation,
++ NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
++ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
++enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+@@ -167,6 +185,12 @@ typedef struct {
+ int monitor;
+ } Rule;
+
++typedef struct Systray Systray;
++struct Systray {
++ Window win;
++ Client *icons;
++};
++
+ /* function declarations */
+ static void applyrules(Client *c);
+ static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
+@@ -201,9 +225,11 @@ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
+ static void focusstack(const Arg *arg);
++static Atom getatomprop(Client *c, Atom prop);
+ static unsigned long getcolor(const char *colstr);
+ static Bool getrootptr(int *x, int *y);
+ static long getstate(Window w);
++static unsigned int getsystraywidth();
+ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
+ static void grabbuttons(Client *c, Bool focused);
+ static void grabkeys(void);
+@@ -222,13 +248,16 @@ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+ static void quit(const Arg *arg);
+ static Monitor *recttomon(int x, int y, int w, int h);
++static void removesystrayicon(Client *i);
+ static void resize(Client *c, int x, int y, int w, int h, Bool interact);
++static void resizebarwin(Monitor *m);
+ static void resizeclient(Client *c, int x, int y, int w, int h);
+ static void resizemouse(const Arg *arg);
++static void resizerequest(XEvent *e);
+ static void restack(Monitor *m);
+ static void run(void);
+ static void scan(void);
+-static Bool sendevent(Client *c, Atom proto);
++static Bool sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
+ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+@@ -257,12 +286,16 @@ static void updatebars(void);
+ static void updatenumlockmask(void);
+ static void updatesizehints(Client *c);
+ static void updatestatus(void);
++static void updatesystray(void);
++static void updatesystrayicongeom(Client *i, int w, int h);
++static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
+ static void updatewindowtype(Client *c);
+ static void updatetitle(Client *c);
+ static void updatewmhints(Client *c);
+ static void view(const Arg *arg);
+ static Client *wintoclient(Window w);
+ static Monitor *wintomon(Window w);
++static Client *wintosystrayicon(Window w);
+ static int xerror(Display *dpy, XErrorEvent *ee);
+ static int xerrordummy(Display *dpy, XErrorEvent *ee);
+ static int xerrorstart(Display *dpy, XErrorEvent *ee);
+@@ -270,6 +303,8 @@ static void zoom(const Arg *arg);
+ static void bstack(Monitor *m);
+
+ /* variables */
++static Systray *systray = NULL;
++static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+@@ -291,9 +326,10 @@ static void (*handler[LASTEvent]) (XEven
+ [MapRequest] = maprequest,
+ [MotionNotify] = motionnotify,
+ [PropertyNotify] = propertynotify,
++ [ResizeRequest] = resizerequest,
+ [UnmapNotify] = unmapnotify
+ };
+-static Atom wmatom[WMLast], netatom[NetLast];
++static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
+ static Bool running = True;
+ static Cursor cursor[CurLast];
+ static Display *dpy;
+@@ -518,6 +554,11 @@ cleanup(void) {
+ XFreeCursor(dpy, cursor[CurMove]);
+ while(mons)
+ cleanupmon(mons);
++ if(showsystray) {
++ XUnmapWindow(dpy, systray->win);
++ XDestroyWindow(dpy, systray->win);
++ free(systray);
++ }
+ XSync(dpy, False);
+ XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
+ }
+@@ -554,9 +595,48 @@ clearurgent(Client *c) {
+
+ void
+ clientmessage(XEvent *e) {
++ XWindowAttributes wa;
++ XSetWindowAttributes swa;
+ XClientMessageEvent *cme = &e->xclient;
+ Client *c = wintoclient(cme->window);
+
++ if(showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
++ /* add systray icons */
++ if(cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
++ if(!(c = (Client *)calloc(1, sizeof(Client))))
++ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
++ c->win = cme->data.l[2];
++ c->mon = selmon;
++ c->next = systray->icons;
++ systray->icons = c;
++ XGetWindowAttributes(dpy, c->win, &wa);
++ c->x = c->oldx = c->y = c->oldy = 0;
++ c->w = c->oldw = wa.width;
++ c->h = c->oldh = wa.height;
++ c->oldbw = wa.border_width;
++ c->bw = 0;
++ c->isfloating = True;
++ /* reuse tags field as mapped status */
++ c->tags = 1;
++ updatesizehints(c);
++ updatesystrayicongeom(c, wa.width, wa.height);
++ XAddToSaveSet(dpy, c->win);
++ XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
++ XReparentWindow(dpy, c->win, systray->win, 0, 0);
++ /* use parents background pixmap */
++ swa.background_pixmap = ParentRelative;
++ XChangeWindowAttributes(dpy, c->win, CWBackPixmap, &swa);
++ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
++ /* FIXME not sure if I have to send these events, too */
++ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
++ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
++ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
++ resizebarwin(selmon);
++ updatesystray();
++ setclientstate(c, NormalState);
++ }
++ return;
++ }
+ if(!c)
+ return;
+ if(cme->message_type == netatom[NetWMState]) {
+@@ -607,7 +687,7 @@ configurenotify(XEvent *e) {
+ dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
+ updatebars();
+ for(m = mons; m; m = m->next)
+- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
++ resizebarwin(m);
+ focus(NULL);
+ arrange(NULL);
+ }
+@@ -705,6 +785,11 @@ destroynotify(XEvent *e) {
+
+ if((c = wintoclient(ev->window)))
+ unmanage(c, True);
++ else if((c = wintosystrayicon(ev->window))) {
++ removesystrayicon(c);
++ resizebarwin(selmon);
++ updatesystray();
++ }
+ }
+
+ void
+@@ -760,6 +845,7 @@ drawbar(Monitor *m) {
+ unsigned long *col;
+ Client *c;
+
++ resizebarwin(m);
+ for(c = m->clients; c; c = c->next) {
+ occ |= c->tags;
+ if(c->isurgent)
+@@ -788,6 +874,9 @@ drawbar(Monitor *m) {
+ if(m == selmon) { /* status is only drawn on selected monitor */
+ dc.w = TEXTW(stext);
+ dc.x = m->ww - dc.w;
++ if(showsystray && m == selmon) {
++ dc.x -= getsystraywidth();
++ }
+ if(dc.x < x) {
+ dc.x = x;
+ dc.w = m->ww - x;
+@@ -816,6 +905,7 @@ drawbars(void) {
+
+ for(m = mons; m; m = m->next)
+ drawbar(m);
++ updatesystray();
+ }
+
+ void
+@@ -1006,10 +1096,17 @@ getatomprop(Client *c, Atom prop) {
+ unsigned long dl;
+ unsigned char *p = NULL;
+ Atom da, atom = None;
++ /* FIXME getatomprop should return the number of items and a pointer to
++ * the stored data instead of this workaround */
++ Atom req = XA_ATOM;
++ if(prop == xatom[XembedInfo])
++ req = xatom[XembedInfo];
+
+- if(XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
++ if(XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
+ &da, &di, &dl, &dl, &p) == Success && p) {
+ atom = *(Atom *)p;
++ if(da == xatom[XembedInfo] && dl == 2)
++ atom = ((Atom *)p)[1];
+ XFree(p);
+ }
+ return atom;
+@@ -1051,6 +1148,15 @@ getstate(Window w) {
+ return result;
+ }
+
++unsigned int
++getsystraywidth() {
++ unsigned int w = 0;
++ Client *i;
++ if(showsystray)
++ for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
++ return w ? w + systrayspacing : 1;
++}
++
+ Bool
+ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
+ char **list = NULL;
+@@ -1185,7 +1291,7 @@ void
+ killclient(const Arg *arg) {
+ if(!selmon->sel)
+ return;
+- if(!sendevent(selmon->sel, wmatom[WMDelete])) {
++ if(!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
+ XGrabServer(dpy);
+ XSetErrorHandler(xerrordummy);
+ XSetCloseDownMode(dpy, DestroyAll);
+@@ -1289,6 +1395,12 @@ void
+ maprequest(XEvent *e) {
+ static XWindowAttributes wa;
+ XMapRequestEvent *ev = &e->xmaprequest;
++ Client *i;
++ if((i = wintosystrayicon(ev->window))) {
++ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
++ resizebarwin(selmon);
++ updatesystray();
++ }
+
+ if(!XGetWindowAttributes(dpy, ev->window, &wa))
+ return;
+@@ -1404,6 +1516,16 @@ propertynotify(XEvent *e) {
+ Window trans;
+ XPropertyEvent *ev = &e->xproperty;
+
++ if((c = wintosystrayicon(ev->window))) {
++ if(ev->atom == XA_WM_NORMAL_HINTS) {
++ updatesizehints(c);
++ updatesystrayicongeom(c, c->w, c->h);
++ }
++ else
++ updatesystrayiconstate(c, ev);
++ resizebarwin(selmon);
++ updatesystray();
++ }
+ if((ev->window == root) && (ev->atom == XA_WM_NAME))
+ updatestatus();
+ else if(ev->state == PropertyDelete)
+@@ -1453,12 +1575,33 @@ recttomon(int x, int y, int w, int h) {
+ }
+
+ void
++removesystrayicon(Client *i) {
++ Client **ii;
++
++ if(!showsystray || !i)
++ return;
++ for(ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
++ if(ii)
++ *ii = i->next;
++ free(i);
++}
++
++
++void
+ resize(Client *c, int x, int y, int w, int h, Bool interact) {
+ if(applysizehints(c, &x, &y, &w, &h, interact))
+ resizeclient(c, x, y, w, h);
+ }
+
+ void
++resizebarwin(Monitor *m) {
++ unsigned int w = m->ww;
++ if(showsystray && m == selmon)
++ w -= getsystraywidth();
++ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
++}
++
++void
+ resizeclient(Client *c, int x, int y, int w, int h) {
+ XWindowChanges wc;
+
+@@ -1523,6 +1666,18 @@ resizemouse(const Arg *arg) {
+ }
+
+ void
++resizerequest(XEvent *e) {
++ XResizeRequestEvent *ev = &e->xresizerequest;
++ Client *i;
++
++ if((i = wintosystrayicon(ev->window))) {
++ updatesystrayicongeom(i, ev->width, ev->height);
++ resizebarwin(selmon);
++ updatesystray();
++ }
++}
++
++void
+ restack(Monitor *m) {
+ Client *c;
+ XEvent ev;
+@@ -1606,25 +1761,35 @@ setclientstate(Client *c, long state) {
+ }
+
+ Bool
+-sendevent(Client *c, Atom proto) {
++sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4) {
+ int n;
+- Atom *protocols;
++ Atom *protocols, mt;
+ Bool exists = False;
+ XEvent ev;
+
+- if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
+- while(!exists && n--)
+- exists = protocols[n] == proto;
+- XFree(protocols);
++ if(proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) {
++ mt = wmatom[WMProtocols];
++ if(XGetWMProtocols(dpy, w, &protocols, &n)) {
++ while(!exists && n--)
++ exists = protocols[n] == proto;
++ XFree(protocols);
++ }
++ }
++ else {
++ exists = True;
++ mt = proto;
+ }
+ if(exists) {
+ ev.type = ClientMessage;
+- ev.xclient.window = c->win;
+- ev.xclient.message_type = wmatom[WMProtocols];
++ ev.xclient.window = w;
++ ev.xclient.message_type = mt;
+ ev.xclient.format = 32;
+- ev.xclient.data.l[0] = proto;
+- ev.xclient.data.l[1] = CurrentTime;
+- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
++ ev.xclient.data.l[0] = d0;
++ ev.xclient.data.l[1] = d1;
++ ev.xclient.data.l[2] = d2;
++ ev.xclient.data.l[3] = d3;
++ ev.xclient.data.l[4] = d4;
++ XSendEvent(dpy, w, False, mask, &ev);
+ }
+ return exists;
+ }
+@@ -1633,7 +1798,7 @@ void
+ setfocus(Client *c) {
+ if(!c->neverfocus)
+ XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
+- sendevent(c, wmatom[WMTakeFocus]);
++ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
+ }
+
+ void
+@@ -1713,11 +1878,17 @@ setup(void) {
+ wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
+ netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
++ netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
++ netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
++ netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
+ netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
+ netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
+ netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+ netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+ netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
++ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
++ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
++ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
+ /* init cursors */
+ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
+ cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
+@@ -1733,6 +1904,8 @@ setup(void) {
+ XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
+ if(!dc.font.set)
+ XSetFont(dpy, dc.gc, dc.font.xfont->fid);
++ /* init system tray */
++ updatesystray();
+ /* init bars */
+ updatebars();
+ updatestatus();
+@@ -1841,7 +2014,18 @@ void
+ togglebar(const Arg *arg) {
+ selmon->showbar = !selmon->showbar;
+ updatebarpos(selmon);
+- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
++ resizebarwin(selmon);
++ if(showsystray) {
++ XWindowChanges wc;
++ if(!selmon->showbar)
++ wc.y = -bh;
++ else if(selmon->showbar) {
++ wc.y = 0;
++ if(!selmon->topbar)
++ wc.y = selmon->mh - bh;
++ }
++ XConfigureWindow(dpy, systray->win, CWY, &wc);
++ }
+ arrange(selmon);
+ }
+
+@@ -1964,18 +2148,28 @@ unmapnotify(XEvent *e) {
+ else
+ unmanage(c, False);
+ }
++ else if((c = wintosystrayicon(ev->window))) {
++ removesystrayicon(c);
++ resizebarwin(selmon);
++ updatesystray();
++ }
+ }
+
+ void
+ updatebars(void) {
++ unsigned int w;
+ Monitor *m;
++
+ XSetWindowAttributes wa = {
+ .override_redirect = True,
+ .background_pixmap = ParentRelative,
+ .event_mask = ButtonPressMask|ExposureMask
+ };
+ for(m = mons; m; m = m->next) {
+- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
++ w = m->ww;
++ if(showsystray && m == selmon)
++ w -= getsystraywidth();
++ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
+ CopyFromParent, DefaultVisual(dpy, screen),
+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
+@@ -2159,6 +2353,104 @@ updatestatus(void) {
+ }
+
+ void
++updatesystrayicongeom(Client *i, int w, int h) {
++ if(i) {
++ i->h = bh;
++ if(w == h)
++ i->w = bh;
++ else if(h == bh)
++ i->w = w;
++ else
++ i->w = (int) ((float)bh * ((float)w / (float)h));
++ applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
++ /* force icons into the systray dimenons if they don't want to */
++ if(i->h > bh) {
++ if(i->w == i->h)
++ i->w = bh;
++ else
++ i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
++ i->h = bh;
++ }
++ }
++}
++
++void
++updatesystrayiconstate(Client *i, XPropertyEvent *ev) {
++ long flags;
++ int code = 0;
++
++ if(!showsystray || !i || ev->atom != xatom[XembedInfo] ||
++ !(flags = getatomprop(i, xatom[XembedInfo])))
++ return;
++
++ if(flags & XEMBED_MAPPED && !i->tags) {
++ i->tags = 1;
++ code = XEMBED_WINDOW_ACTIVATE;
++ XMapRaised(dpy, i->win);
++ setclientstate(i, NormalState);
++ }
++ else if(!(flags & XEMBED_MAPPED) && i->tags) {
++ i->tags = 0;
++ code = XEMBED_WINDOW_DEACTIVATE;
++ XUnmapWindow(dpy, i->win);
++ setclientstate(i, WithdrawnState);
++ }
++ else
++ return;
++ sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
++ systray->win, XEMBED_EMBEDDED_VERSION);
++}
++
++void
++updatesystray(void) {
++ XSetWindowAttributes wa;
++ Client *i;
++ unsigned int x = selmon->mx + selmon->mw;
++ unsigned int w = 1;
++
++ if(!showsystray)
++ return;
++ if(!systray) {
++ /* init systray */
++ if(!(systray = (Systray *)calloc(1, sizeof(Systray))))
++ die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
++ systray->win = XCreateSimpleWindow(dpy, root, x, selmon->by, w, bh, 0, 0, dc.colors[1][ColBG]);
++ wa.event_mask = ButtonPressMask | ExposureMask;
++ wa.override_redirect = True;
++ wa.background_pixmap = ParentRelative;
++ wa.background_pixel = dc.colors[0][ColBG];
++ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
++ XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
++ PropModeReplace, (unsigned char *)&systrayorientation, 1);
++ XChangeWindowAttributes(dpy, systray->win, CWEventMask | CWOverrideRedirect | CWBackPixel, &wa);
++ XMapRaised(dpy, systray->win);
++ XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
++ if(XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
++ sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
++ XSync(dpy, False);
++ }
++ else {
++ fprintf(stderr, "dwm: unable to obtain system tray.\n");
++ free(systray);
++ systray = NULL;
++ return;
++ }
++ }
++ for(w = 0, i = systray->icons; i; i = i->next) {
++ XMapRaised(dpy, i->win);
++ w += systrayspacing;
++ XMoveResizeWindow(dpy, i->win, (i->x = w), 0, i->w, i->h);
++ w += i->w;
++ if(i->mon != selmon)
++ i->mon = selmon;
++ }
++ w = w ? w + systrayspacing : 1;
++ x -= w;
++ XMoveResizeWindow(dpy, systray->win, x, selmon->by, w, bh);
++ XSync(dpy, False);
++}
++
++void
+ updatewindowtype(Client *c) {
+ Atom state = getatomprop(c, netatom[NetWMState]);
+ Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
+@@ -2245,6 +2537,16 @@ wintomon(Window w) {
+ return selmon;
+ }
+
++Client *
++wintosystrayicon(Window w) {
++ Client *i = NULL;
++
++ if(!showsystray || !w)
++ return i;
++ for(i = systray->icons; i && i->win != w; i = i->next) ;
++ return i;
++}
++
+ /* There's no way to check accesses to destroyed windows, thus those cases are
+ * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
+ * default error handler, which may call exit. */
View
5 README.md
@@ -1,4 +1,7 @@
dwm-config
==========
-My configuration and patches for dwm-6.0
+My configuration and patches for dwm-6.0
+
+The patches and configuration for color status bar
+are taken from ok100 repository
View
198 config.h
@@ -0,0 +1,198 @@
+/* See LICENSE in dwm source code package for copyright and license details. */
+/**/
+/* This is the config.h for dwm with icons and colors in font.*/
+/**/
+/* This file was made by gnusosa (gnusosa@gnusosa.net)*/
+/* 8169 8649 6995 DF85 80AD F778 A145 52AD A100 F1A7 */
+/* This file can be distributed under the same license that dwm works with */
+
+
+#include "im-grid.c"
+#include "push.c"
+#include "X11/XF86keysym.h"
+#include "togglefullscreen.c"
+
+/* appearance */
+static const char font[] = "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*" "," "-*-termsyn-medium-*-*-*-11-*-*-*-*-*-*-*";
+
+#define NUMCOLORS 21
+static const char colors[NUMCOLORS][ColLast][21] = {
+ // border foreground background
+ { "#1A1A1A", "#808080", "#020202" }, // 01 - normal
+ { "#4C4C4C", "#B3B3B3", "#020202" }, // 02 - selected
+ { "#B3354C", "#B3354C", "#020202" }, // 03 - urgent
+
+ { "#1A1A1A", "#1A1A1A", "#020202" }, // 04 - black
+ { "#802635", "#802635", "#020202" }, // 05 - red
+ { "#608040", "#608040", "#020202" }, // 06 - green
+ { "#877C43", "#877C43", "#020202" }, // 07 - yellow
+ { "#1C678C", "#1C678C", "#020202" }, // 08 - blue
+ { "#684D80", "#684D80", "#020202" }, // 09 - magenta
+ { "#000000", "#000000", "#000000" }, // unusable
+ { "#337373", "#337373", "#020202" }, // 0B - cyan
+ { "#808080", "#808080", "#020202" }, // 0C - light gray
+ { "#4C4C4C", "#4C4C4C", "#020202" }, // 0D - gray
+ { "#B3354C", "#B3354C", "#020202" }, // 0E - light red
+ { "#4BA65A", "#4BA65A", "#020202" }, // 0F - light green
+ { "#BF9F5F", "#BF9F5F", "#020202" }, // 10 - light yellow
+ { "#3995BF", "#3995BF", "#020202" }, // 11 - light blue
+ { "#A64286", "#A64286", "#020202" }, // 12 - light magenta
+ { "#6C98A6", "#6C98A6", "#020202" }, // 13 - light cyan
+ { "#B3B3B3", "#B3B3B3", "#020202" }, // 14 - white
+
+ { "#802635", "#BF9F5F", "#802635" }, // 15 - warning
+};
+
+static const unsigned int borderpx = 1; // border pixel of windows
+static const unsigned int snap = 5; // snap pixel
+static const unsigned int systrayspacing = 1; // space between systray icons
+static const Bool showsystray = False; // False means no systray
+static const Bool showbar = True; // False means no bar
+static const Bool topbar = True; // False means bottom bar
+static Bool useicons = True; // False means use ascii symbols
+static const char scratchpadname[] = "Scratchpad";
+
+/* layout(s) */
+static const float mfact = 0.50; // factor of master area size [0.05..0.95]
+static const Bool resizehints = False; // True means respect size hints in tiled resizals
+static const int nmaster = 1; // default number of clients in the master area
+
+static const Layout layouts[] = {
+ // icon symbol arrange function
+ { "/home/gnusosa/.dwm/icons/tile.xbm", "þ", tile },
+ { "/home/gnusosa/.dwm/icons/bstack.xbm", "ü", bstack },
+ { "/home/gnusosa/.dwm/icons/float.xbm", "ý", NULL }, // no layout function means floating behavior
+ { "/home/gnusosa/.dwm/icons/monocle.xbm", "ÿ", monocle },
+ { "/home/gnusosa/.dwm/icons/grid.xbm", "ú", imgrid },
+};
+
+static const MonocleNumberedIcon monoclenumberedicons[] = {
+ { "/home/gnusosa/.dwm/icons/monocle0.xbm" },
+ { "/home/gnusosa/.dwm/icons/monocle1.xbm" },
+ { "/home/gnusosa/.dwm/icons/monocle2.xbm" },
+ { "/home/gnusosa/.dwm/icons/monocle3.xbm" },
+ { "/home/gnusosa/.dwm/icons/monocle4.xbm" },
+ { "/home/gnusosa/.dwm/icons/monocle5.xbm" },
+};
+
+/* tagging */
+static const Tag tags[] = {
+ // name layout mfact nmaster
+ //{ "", &layouts[3], -1, -1 },
+ { "", &layouts[0], 0.65, -1 },
+ { "", &layouts[3], -1, -1 },
+ { "", &layouts[3], -1, -1 },
+ { "", &layouts[3], -1, -1 },
+ { "", &layouts[4], 0.22, -1 },
+ { "", &layouts[0], 0.65, -1 },
+ { "", &layouts[0], 0.65, -1 },
+ { "", &layouts[3], -1, -1 },
+ { "", &layouts[2], -1, -1 },
+};
+
+/* window rules */
+static const Rule rules[] = {
+ // class instance title tags mask isfloating iscentred monitor
+ { "mplayer", NULL, NULL, 0, True, -1 },
+ { "Firefox", NULL, NULL, 1 << 3, False, -1 },
+};
+
+/* key definitions */
+#define MODKEY Mod4Mask
+#define TAGKEYS(KEY,TAG) \
+ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
+ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
+
+/* helper for spawning shell commands in the pre dwm-5.0 fashion */
+#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+
+/* commands */
+static const char *dmenucmd[] ={ "dmenu_run", "-i", "-fn", font, "-nb", colors[0][ColBG], "-nf", colors[0][ColFG],"-sb", colors[1][ColBG], "-sf", colors[1][ColFG], NULL };
+static const char *termcmd[] = { "urxvtc", NULL };
+static const char *scratchpadcmd[] = { "urxvtc", "-title", scratchpadname, "-geometry", "70x9+400+10", NULL };
+
+#include "moveresize.c"
+static Key keys[] = {
+ // modifier key function argument
+ /* Here starts the moveresize keys */
+ { MODKEY, XK_Down, moveresize, {.v = (int []){ 0, 25, 0, 0 }}},
+ { MODKEY, XK_Up, moveresize, {.v = (int []){ 0, -25, 0, 0 }}},
+ { MODKEY, XK_Right, moveresize, {.v = (int []){ 25, 0, 0, 0 }}},
+ { MODKEY, XK_Left, moveresize, {.v = (int []){ -25, 0, 0, 0 }}},
+ { MODKEY|ShiftMask, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 25 }}},
+ { MODKEY|ShiftMask, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -25 }}},
+ { MODKEY|ShiftMask, XK_Right, moveresize, {.v = (int []){ 0, 0, 25, 0 }}},
+ { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}},
+ /* Here ends the moveresize keys */
+ /* Here starts the nmaster keys */
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ /*{ MODKEY, XK_x, setnmaster, {.i = 2 } },*/
+ { MODKEY, XK_Tab, swapfocus, {0} },
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+ { MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY|ShiftMask, XK_c, killclient, {0} },
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_b, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
+ { MODKEY|ShiftMask, XK_f, togglefullscreen, {0} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[3]} },
+ { MODKEY, XK_g, setlayout, {.v = &layouts[4]} },
+ { 0, XK_F12, togglescratch, {.v = scratchpadcmd} },
+ { MODKEY|ShiftMask, XK_b, togglebar, {0} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+ { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
+ { MODKEY, XK_comma, focusmon, {.i = -1 } },
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+ TAGKEYS( XK_4, 3)
+ TAGKEYS( XK_5, 4)
+ TAGKEYS( XK_6, 5)
+ TAGKEYS( XK_7, 6)
+ TAGKEYS( XK_8, 7)
+ TAGKEYS( XK_9, 8)
+ { MODKEY|ShiftMask, XK_q, quit, {0} },
+ /*{ 0, XF86XK_Launch1, spawn, {.v = screenoffcmd } },
+ { 0, XF86XK_PowerOff, spawn, {.v = shutdowncmd } },
+ { 0, XF86XK_AudioLowerVolume, spawn, {.v = voldowncmd } },
+ { 0, XF86XK_AudioMute, spawn, {.v = voltogglecmd } },
+ { 0, XF86XK_AudioRaiseVolume, spawn, {.v = volupcmd } },
+ */
+};
+
+#include "tilemovemouse.c"
+/* button definitions */
+// click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin
+static Button buttons[] = {
+ // click event mask button function argument
+ { ClkLtSymbol, 0, Button1, setlayout, {0} },
+ { ClkWinTitle, 0, Button1, focusstack, {.i = +1 } },
+ { ClkWinTitle, 0, Button3, focusstack, {.i = -1 } },
+ { ClkClientWin, MODKEY, Button1, tilemovemouse, {0} },
+ { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
+ { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkTagBar, 0, Button1, view, {0} },
+ { ClkTagBar, 0, Button3, toggleview, {0} },
+ { ClkTagBar, MODKEY, Button1, tag, {0} },
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+ /*{ ClkRootWin, 0, Button3, spawn, {.v = menucmd } },
+ { ClkStatusText, 0, Button1, spawn, {.v = calendarcmd } },
+ { ClkStatusText, 0, Button3, spawn, {.v = menucmd } },
+ */
+};
+
View
13 dotdwm/dwm-start
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Script to start dwm in loop
+
+while true; do
+ $HOME/.dwm/dwm-status
+ sleep 2
+done &
+
+while true; do
+ dwm >/dev/null
+ # to log stderrors to a file
+ # dwm 2> ~/Build/dwm/dwm.log
+done
View
74 dotdwm/dwm-status
@@ -0,0 +1,74 @@
+#!/bin/bash
+# Status script for dwm
+# colours: 01:normal 02:white 03:red 04:green 05:yellow 06:blue 07:cyan 08:magenta 09:grey
+
+bat(){
+ ac="$(awk 'NR==1 {print +$4}' <(acpi -V))"
+ onl="$(grep "on-line" <(acpi -V))"
+ if [ -z "$onl" ] && [ "$ac" -gt "85" ]; then
+ echo -e "\x07$ac%\x01"
+ elif [ -z "$onl" ] && [ "$ac" -gt "15" ]; then
+ echo -e "\x07$ac%\x01"
+ elif [ -z "$onl" ] && [ "$ac" -le "15" ]; then
+ echo -e "\x03$ac%\x01"
+ elif [ -z "$onl" ] && [ "$ac" -le "5" ]; then
+ echo -e "\x03$ac%\x01"
+ else
+ echo -e "\x07$ac%\x01"
+ fi
+}
+
+mem(){
+ mem="$(awk '/^-/ {print $3}' <(free -m))"
+ echo -e "\x04$mem\x01"
+}
+
+ # CPU line courtesy Procyon:https://bbs.archlinux.org/viewtopic.php?pid=874333#p874333
+cpu(){
+ read cpu a b c previdle rest < /proc/stat
+ prevtotal=$((a+b+c+previdle))
+ sleep 0.5
+ read cpu a b c idle rest < /proc/stat
+ total=$((a+b+c+idle))
+ cpu="$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))"
+ echo -e "\x05$cpu%\x01"
+ }
+
+hdd(){
+ hd="$(df -P | sort -d | awk '/^\/dev\//{s=s (s?" ":"") $5} END {printf "%s", s}')"
+ echo -e "\x08$hd\x01"
+}
+
+#eml(){
+# maildirs="$HOME/Mail/*/INBOX/new/"
+# ml="$(find $maildirs -type f | wc -l)"
+# if [ $ml == 0 ]; then
+# echo "0"
+# else
+# echo -en "\x03$ml\x01"
+# fi
+#}
+
+#pac(){
+# pup="$(pacman -Qqu --dbpath /tmp/checkup-db-jason/ | wc -l)"
+# if [ $pup == 0 ]; then
+# echo "0"
+# else
+# echo -en "\x05$pup\x01"
+# fi
+#}
+
+int(){
+ host google.com>/dev/null &&
+ echo -e "\x06ON\x01" || echo -e "\x03NO\x01"
+}
+
+dte(){
+ dte="$(date "+%I:%M")"
+ echo -e "\x02$dte\x01"
+}
+
+ # Pipe to status bar
+#xsetroot -name "[$(bat)] [$(cpu) $(mem)] [$(hdd)] [EML $(eml) PKG $(pac)] [NET $(int)] $(dte) "
+xsetroot -name "[$(bat)] [$(cpu)][$(mem)] [$(hdd)] [NET $(int)] $(dte) "
+
View
55 dwm-6.0-swapfocus.diff
@@ -0,0 +1,55 @@
+URL: http://dwm.suckless.org/patches/swapfocus
+This patch makes it possible to switch focus with one single shortcut (alt-s)
+instead of having to think if you should use alt-j or alt-k for reaching the
+last used window.
+
+diff -r ec4baab78314 dwm.c
+--- a/dwm.c Mon Dec 19 15:38:30 2011 +0100
++++ b/dwm.c Fri Apr 06 08:23:42 2012 +0200
+@@ -224,6 +224,7 @@
+ static void showhide(Client *c);
+ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
++static void swapfocus();
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static int textnw(const char *text, unsigned int len);
+@@ -253,6 +254,7 @@
+ static void zoom(const Arg *arg);
+
+ /* variables */
++static Client *prevclient = NULL;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+@@ -1675,6 +1677,14 @@
+ }
+
+ void
++swapfocus(){
++ Client *c;
++ for(c = selmon->clients; c && c != prevclient; c = c->next) ;
++ if(c == prevclient)
++ focus(prevclient);
++}
++
++void
+ tag(const Arg *arg) {
+ if(selmon->sel && arg->ui & TAGMASK) {
+ selmon->sel->tags = arg->ui & TAGMASK;
+@@ -1775,6 +1785,7 @@
+ unfocus(Client *c, Bool setfocus) {
+ if(!c)
+ return;
++ prevclient = c;
+ grabbuttons(c, False);
+ XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
+ if(setfocus)
+@@ -2116,6 +2127,7 @@
+ void
+ zoom(const Arg *arg) {
+ Client *c = selmon->sel;
++ prevclient = selmon->clients;
+
+ if(!selmon->lt[selmon->sellt]->arrange
+ || (selmon->sel && selmon->sel->isfloating))
View
6 icons/bstack.xbm
@@ -0,0 +1,6 @@
+#define bstack_width 12
+#define bstack_height 13
+static unsigned char bstack_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03,
+ 0x00, 0x00, 0x6c, 0x03, 0x6c, 0x03, 0x6c, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/float.xbm
@@ -0,0 +1,6 @@
+#define float_width 12
+#define float_height 13
+static unsigned char float_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x03,
+ 0x0c, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/grid.xbm
@@ -0,0 +1,6 @@
+#define grid_width 12
+#define grid_height 13
+static unsigned char grid_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x03, 0x6c, 0x03, 0x00, 0x00, 0x6c, 0x03,
+ 0x6c, 0x03, 0x00, 0x00, 0x6c, 0x03, 0x6c, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle.xbm
@@ -0,0 +1,6 @@
+#define monocle0_width 12
+#define monocle0_height 13
+static unsigned char monocle0_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03,
+ 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle0.xbm
@@ -0,0 +1,6 @@
+#define monocle_width 12
+#define monocle_height 13
+static unsigned char monocle_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0x0c, 0x03, 0x0c, 0x03,
+ 0x0c, 0x03, 0x0c, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle1.xbm
@@ -0,0 +1,6 @@
+#define monocle1_width 12
+#define monocle1_height 13
+static unsigned char monocle1_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x9c, 0x03,
+ 0x9c, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle2.xbm
@@ -0,0 +1,6 @@
+#define monocle2_width 12
+#define monocle2_height 13
+static unsigned char monocle2_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x7c, 0x02, 0x7c, 0x02, 0xfc, 0x03,
+ 0xfc, 0x03, 0xe4, 0x03, 0xe4, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle3.xbm
@@ -0,0 +1,6 @@
+#define monocle3_width 12
+#define monocle3_height 13
+static unsigned char monocle3_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x7c, 0x02, 0x7c, 0x02, 0x9c, 0x03,
+ 0x9c, 0x03, 0xe4, 0x03, 0xe4, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle4.xbm
@@ -0,0 +1,6 @@
+#define monocle4_width 12
+#define monocle4_height 13
+static unsigned char monocle4_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03,
+ 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/monocle5.xbm
@@ -0,0 +1,6 @@
+#define monocle5_width 12
+#define monocle5_height 13
+static unsigned char monocle5_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0x9c, 0x03,
+ 0x9c, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
6 icons/tile.xbm
@@ -0,0 +1,6 @@
+#define tile_width 12
+#define tile_height 13
+static unsigned char tile_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xbc, 0x03, 0xbc, 0x03, 0x3c, 0x00, 0xbc, 0x03,
+ 0xbc, 0x03, 0x3c, 0x00, 0xbc, 0x03, 0xbc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
61 im-grid.c
@@ -0,0 +1,61 @@
+static const char wmname[] = "Skype";
+
+/* layout's mfact is buddy list width as ww % */
+void
+imgrid(Monitor *m) {
+ unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch;
+ int wx; /* buddy list width and grid's wx */
+ int ww; /* grid's ww */
+ Client *c;
+ Client *bl = NULL; /* buddy list */
+
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
+ if(strstr(c->name, wmname)) {
+ bl = c;
+ }
+ }
+ if(n == 0)
+ return;
+
+ /* buddy list */
+ if(bl) {
+ wx = m->mfacts[m->curtag] * m->ww;
+ ww = m->ww - wx;
+ resize(bl, m->wx, m->wy, wx - 2 * bl->bw, m->wh - 2 * bl->bw, False);
+ if(--n == 0)
+ return;
+ } else {
+ wx = m->wx;
+ ww = m->ww;
+ }
+
+ /* grid dimensions */
+ for(cols = 0; cols <= n/2; cols++)
+ if(cols*cols >= n)
+ break;
+ if(n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
+ cols = 2;
+ rows = n/cols;
+
+ /* window geometries */
+ cw = cols ? ww / cols : ww;
+ cn = 0; /* current column number */
+ rn = 0; /* current row number */
+ for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
+ if(c == bl) {
+ --i;
+ continue;
+ }
+ if(i/rows + 1 > cols - n%cols)
+ rows = n/cols + 1;
+ ch = rows ? m->wh / rows : m->wh;
+ cx = wx + cn*cw;
+ cy = m->wy + rn*ch;
+ resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
+ rn++;
+ if(rn >= rows) {
+ rn = 0;
+ cn++;
+ }
+ }
+}
View
64 moveresize.c
@@ -0,0 +1,64 @@
+void
+moveresize(const Arg *arg) {
+ /* only floating windows can be moved */
+ Client *c;
+ c = selmon->sel;
+ int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
+ char xAbs, yAbs, wAbs, hAbs;
+ int msx, msy, dx, dy, nmx, nmy;
+ unsigned int dui;
+ Window dummy;
+
+ if (!c || !arg)
+ return;
+ if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
+ return;
+ if(sscanf((char *)arg->v, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8)
+ return;
+ /* compute new window position; prevent window from be positioned outside the current monitor */
+ nw = c->w + w;
+ if(wAbs == 'W')
+ nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw;
+
+ nh = c->h + h;
+ if(hAbs == 'H')
+ nh = h < selmon->mh - 2 * c->bw ? h : selmon->mh - 2 * c->bw;
+
+ nx = c->x + x;
+ if(xAbs == 'X') {
+ if(x < selmon->mx)
+ nx = selmon->mx;
+ else if(x > selmon->mx + selmon->mw)
+ nx = selmon->mx + selmon->mw - nw - 2 * c->bw;
+ else
+ nx = x;
+ }
+
+ ny = c->y + y;
+ if(yAbs == 'Y') {
+ if(y < selmon->my)
+ ny = selmon->my;
+ else if(y > selmon->my + selmon->mh)
+ ny = selmon->my + selmon->mh - nh - 2 * c->bw;
+ else
+ ny = y;
+ }
+
+ ox = c->x;
+ oy = c->y;
+ ow = c->w;
+ oh = c->h;
+
+ XRaiseWindow(dpy, c->win);
+ Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui);
+ resize(c, nx, ny, nw, nh, True);
+
+ /* move cursor along with the window to avoid problems caused by the sloppy focus */
+ if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy)
+ {
+ nmx = c->x - ox + c->w - ow;
+ nmy = c->y - oy + c->h - oh;
+ XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy);
+ }
+}
+
View
58 push.c
@@ -0,0 +1,58 @@
+static Client *
+prevtiled(Client *c) {
+ Client *p, *r;
+
+ for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
+ if(!p->isfloating && ISVISIBLE(p))
+ r = p;
+ return r;
+}
+
+static void
+pushup(const Arg *arg) {
+ Client *sel = selmon->sel;
+ Client *c;
+
+ if(!sel || sel->isfloating)
+ return;
+ if((c = prevtiled(sel))) {
+ /* attach before c */
+ detach(sel);
+ sel->next = c;
+ if(selmon->clients == c)
+ selmon->clients = sel;
+ else {
+ for(c = selmon->clients; c->next != sel->next; c = c->next);
+ c->next = sel;
+ }
+ } else {
+ /* move to the end */
+ for(c = sel; c->next; c = c->next);
+ detach(sel);
+ sel->next = NULL;
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
+static void
+pushdown(const Arg *arg) {
+ Client *sel = selmon->sel;
+ Client *c;
+
+ if(!sel || sel->isfloating)
+ return;
+ if((c = nexttiled(sel->next))) {
+ /* attach after c */
+ detach(sel);
+ sel->next = c->next;
+ c->next = sel;
+ } else {
+ /* move to the front */
+ detach(sel);
+ attach(sel);
+ }
+ focus(sel);
+ arrange(selmon);
+}
View
72 tilemovemouse.c
@@ -0,0 +1,72 @@
+#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
+
+void
+insertbefore(Client *a, Client *b) /* insert a before b in the client list */
+{
+ Monitor *m = a->mon;
+ Client **x = &m->clients;
+
+ while(*x != b && *x)
+ x = & (*x)->next;
+ *x = a;
+ a->next = b;
+}
+
+void
+insertafter(Client *a, Client *b) /* insert a after b in the client list */
+{
+ a->next = b->next;
+ b->next = a;
+}
+
+void
+tilemovemouse(const Arg *arg) {
+ /* Could EnterNotify events be used instead? */
+ Client *c, *d;
+ Monitor *m;
+ XEvent ev;
+ int x, y;
+ Bool after;
+
+ if(!(c = selmon->sel))
+ return;
+
+ if((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
+ sendmon(c, m);
+ selmon = m;
+ focus(NULL);
+ }
+
+ if(c->isfloating || !selmon->lt[selmon->sellt]->arrange){
+ movemouse(NULL);
+ return;
+ }
+ if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurMove], CurrentTime) != GrabSuccess)
+ return;
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch (ev.type) {
+ case ConfigureRequest:
+ case Expose:
+ case MapRequest:
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+ x = ev.xmotion.x;
+ y = ev.xmotion.y;
+ after = False;
+ for(d = nexttiled(m->clients); d; d = nexttiled(d->next)){
+ if(d == c)
+ after = True;
+ else if(INRECT(x, y, d->x, d->y, d->w+2*borderpx, d->h+2*borderpx)){
+ detach(c);
+ after ? insertafter(c, d) : insertbefore(c,d);
+ arrange(c->mon);
+ break;
+ }
+ }
+ }
+ } while(ev.type != ButtonRelease);
+ XUngrabPointer(dpy, CurrentTime);
+}
View
34 togglefullscreen.c
@@ -0,0 +1,34 @@
+void togglefullscreen(const Arg *arg);
+
+void
+togglefullscreen(const Arg *arg) {
+ Client *c = selmon->sel;
+
+ if(!c)
+ return;
+ if(!c->isfullscreen) {
+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
+ PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
+ c->isfullscreen = True;
+ c->oldstate = c->isfloating;
+ c->oldbw = c->bw;
+ c->bw = 0;
+ c->isfloating = True;
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ XRaiseWindow(dpy, c->win);
+ }
+ else
+ {
+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
+ PropModeReplace, (unsigned char*)0, 0);
+ c->isfullscreen = False;
+ c->isfloating = c->oldstate;
+ c->bw = c->oldbw;
+ c->x = c->oldx;
+ c->y = c->oldy;
+ c->w = c->oldw;
+ c->h = c->oldh;
+ resizeclient(c, c->x, c->y, c->w, c->h);
+ arrange(c->mon);
+ }
+}
View
11 xinitrc
@@ -0,0 +1,11 @@
+xrdb -merge ~/.Xresources
+xset +fp /usr/share/fonts/local
+xset fp rehash
+
+xscreensaver &
+
+urxvtd -q -o -f &
+
+
+exec dbus-launch /home/gnusosa/.dwm/dwm-start
+
Please sign in to comment.
Something went wrong with that request. Please try again.