[dev] [dwm] pertag and bstack for 5.6 release
Hi there, First of all, I got to say thank you to Anselm and the contributors to dwm, which truly is a wonder. I just switched to release 5.6, and ported a couple of patches that I happen to use : bstack and pertag. I don't have a dual head setup to test everything, but in a few hours of usage I haven't noticed any problem with these so far, so I guess I can share them. Many thanks to the original authors of these patches. PS: my C kungfu is a bit rusty and there is a compiler warning I haven't taken time to fix with the pertag patch. Boo-boo me at will. -- Francois Gombault--- a/config.def.h 2009-07-15 16:03:15.0 +0200 +++ b/config.def.h 2009-07-15 15:57:17.0 +0200 @@ -31,6 +30,7 @@ { "[]=", tile },/* first entry is default */ { "><>", NULL },/* no layout function means floating behavior */ { "[M]", monocle }, + { "TTT", bstack }, }; /* key definitions */ --- a/dwm.c 2009-07-14 20:07:55.0 +0200 +++ b/dwm.c 2009-07-15 16:11:51.0 +0200 @@ -213,6 +213,7 @@ static void tagmon(const Arg *arg); static int textnw(const char *text, unsigned int len); static void tile(Monitor *); +static void bstack(Monitor *); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -1571,6 +1572,38 @@ } 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; + + 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; + + 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(h < bh) + h = m->wh; + + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, ((i + 1 == n) ? m->wx + m->ww - x : w) - 2 * c->bw, + h - 2 * c->bw, False); + if(w != m->ww) + x = c->x + WIDTH(c); + } +} + +void togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; updatebarpos(selmon); --- a/dwm.c 2009-07-14 20:07:55.0 +0200 +++ b/dwm.c 2009-07-15 15:32:33.0 +0200 @@ -120,25 +120,6 @@ void (*arrange)(Monitor *); } Layout; -struct Monitor { - 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; @@ -270,6 +251,30 @@ /* configuration, allows nested code to access above variables */ #include "config.h" +struct Monitor { + 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; + Layout *lts[LENGTH(tags) + 1]; + double mfacts[LENGTH(tags) + 1]; + Bool showbars[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]; }; @@ -1401,7 +1406,7 @@ 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; if(selmon->sel) arrange(); else @@ -1418,7 +1423,7 @@ 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(); } @@ -1427,6 +1432,7 @@ unsigned int i; int w; XSetWindowAttributes wa; + Monitor *m; /* init screen */ screen = DefaultScreen(dpy); @@ -1458,11 +1464,31 @@ XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); if(!dc.font.set) XSetFont(dpy, dc.gc, dc.font.xfont->fid); + /* 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]; + } + } /* init bars */ for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { w = TEXTW(layouts[i].symbol); blw = MAX(blw, w); } + for(m = mons; m; m = m->next) { + for(i=0; i <
Re: [dev] OT - suckless or not ? :)
Well, I think the "suck less" term is not original from our comunity. The same happens with "the Unix philosophy" of XFCE (http://www.xfce.org/): "Xfce 4.6 embodies the traditional UNIX philosophy of modularity and re-usability..." On Wed, Jul 15, 2009 at 3:28 PM, Julien Pecqueur (JPEC) wrote: > I'm very surprised to heard about suckless philosophy on a definetly not > suckless project mailing list : étoilé, a osx-like free project. > > Message original > Objet : Re: [Etoile-discuss] New website blurb > De : Sebastian Nowicki > À : Discussion list for Étoilé desktop environment > Cc : > > > On Jul 14, 2009, at 10:09 PM, Eric Wasylishen wrote: > >> Hi, >> I put a new "introductory paragraph" on http://etoileos.com/. I think >> it will be more effective at getting visitors >> interested..comments/feedback? > > I think it's pretty good. However, depending on the target audience > (average Joe, geeks?) I'm not so sure about the revision history part. > The average Joe probably wouldn't really know what it was or why it's > useful. Maybe "version tracking" (or whatever MS Word uses) would be a > more self-explanatory term. > >> Does anyone object to using the phrase "Making computers suck less?" > > It's not very professional, but I would say it appeals to geeks. It > reminds me a lot of http://www.suckless.org/ > > I think the "read more" site needs some expansion on the various > concepts. At the moment it has a very brief overview of the goals, and > mostly technical stuff (frameworks). > > ___ > Etoile-discuss mailing list > etoile-disc...@gna.org > https://mail.gna.org/listinfo/etoile-discuss >
Re: [dev] OT - suckless or not ? :)
osx-like == sucks big time. uriel On Wed, Jul 15, 2009 at 3:28 PM, Julien Pecqueur (JPEC) wrote: > I'm very surprised to heard about suckless philosophy on a definetly not > suckless project mailing list : étoilé, a osx-like free project. > > Message original > Objet : Re: [Etoile-discuss] New website blurb > De : Sebastian Nowicki > À : Discussion list for Étoilé desktop environment > Cc : > > > On Jul 14, 2009, at 10:09 PM, Eric Wasylishen wrote: > >> Hi, >> I put a new "introductory paragraph" on http://etoileos.com/. I think >> it will be more effective at getting visitors >> interested..comments/feedback? > > I think it's pretty good. However, depending on the target audience > (average Joe, geeks?) I'm not so sure about the revision history part. > The average Joe probably wouldn't really know what it was or why it's > useful. Maybe "version tracking" (or whatever MS Word uses) would be a > more self-explanatory term. > >> Does anyone object to using the phrase "Making computers suck less?" > > It's not very professional, but I would say it appeals to geeks. It > reminds me a lot of http://www.suckless.org/ > > I think the "read more" site needs some expansion on the various > concepts. At the moment it has a very brief overview of the goals, and > mostly technical stuff (frameworks). > > ___ > Etoile-discuss mailing list > etoile-disc...@gna.org > https://mail.gna.org/listinfo/etoile-discuss >
Re: [dev] OT - suckless or not ? :)
On Wed, Jul 15, 2009 at 4:45 PM, pmarin wrote: > Well, I think the "suck less" term is not original from our comunity. > The same happens with "the Unix philosophy" of XFCE (http://www.xfce.org/): > > "Xfce 4.6 embodies the traditional UNIX philosophy of modularity > and re-usability..." Xfce devs completely fail at understanding what the Unix philosophy was all about. uriel > > On Wed, Jul 15, 2009 at 3:28 PM, Julien Pecqueur > (JPEC) wrote: >> I'm very surprised to heard about suckless philosophy on a definetly not >> suckless project mailing list : étoilé, a osx-like free project. >> >> Message original >> Objet : Re: [Etoile-discuss] New website blurb >> De : Sebastian Nowicki >> À : Discussion list for Étoilé desktop environment >> Cc : >> >> >> On Jul 14, 2009, at 10:09 PM, Eric Wasylishen wrote: >> >>> Hi, >>> I put a new "introductory paragraph" on http://etoileos.com/. I think >>> it will be more effective at getting visitors >>> interested..comments/feedback? >> >> I think it's pretty good. However, depending on the target audience >> (average Joe, geeks?) I'm not so sure about the revision history part. >> The average Joe probably wouldn't really know what it was or why it's >> useful. Maybe "version tracking" (or whatever MS Word uses) would be a >> more self-explanatory term. >> >>> Does anyone object to using the phrase "Making computers suck less?" >> >> It's not very professional, but I would say it appeals to geeks. It >> reminds me a lot of http://www.suckless.org/ >> >> I think the "read more" site needs some expansion on the various >> concepts. At the moment it has a very brief overview of the goals, and >> mostly technical stuff (frameworks). >> >> ___ >> Etoile-discuss mailing list >> etoile-disc...@gna.org >> https://mail.gna.org/listinfo/etoile-discuss >> > >
Re: [dev] OT - suckless or not ? :)
On Wed, 15 Jul 2009 16:45:49 +0200 pmarin wrote: > Well, I think the "suck less" term is not original from our comunity. > The same happens with "the Unix philosophy" of XFCE (http://www.xfce.org/): > > "Xfce 4.6 embodies the traditional UNIX philosophy of modularity > and re-usability..." > Not to mention the duplicty: - something is suckless (completely void of suck) - something does suck less (still some suck in it) These things are very different, and I think it's very, very hard to reach the first meaning I think option 2 is the commonly accepted one here, but meaning 1 sounds most natural to me. Dieter
Re: [dev] OT - suckless or not ? :)
2009/7/15 pmarin : > Well, I think the "suck less" term is not original from our comunity. http://www.mutt.org/ -sqweek
Re: [dev] [dwm] pertag and bstack for 5.6 release
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I have adapted some patches for dwm 5.6 yesterday, amongst that also pertag and bstack, but I did not had the time to test them well. Since you have added your patches, I will just add the others I've edited: gaplessgrid, grid, push and tilemovemouse. | PS: my C kungfu is a bit rusty and there is a compiler warning I haven't | taken time to fix with the pertag patch. Boo-boo me at will I think that should be: ~m->lts[i] = (Layout*) &layouts[0]; ML -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkpeCFkACgkQ9vCoFTonULRi5QCfU3GixUdB1v6N89TH1uETExtq T2cAnAjciUkxS8Wxlh/E/2o0w4Wowuab =EG85 -END PGP SIGNATURE- void gaplessgrid(Monitor *m) { unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch; Client *c; for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) n++; if(n == 0) return; /* 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 (cell height/width/x/y) */ cw = m->ww / (cols ? cols : 1); cn = 0; /* current column number */ rn = 0; /* current row number */ for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) { if(i/rows+1 > cols-n%cols) rows = n/cols+1; ch = m->wh / (rows ? rows : 1); cx = m->wx + cn*cw; cy = m->wy + rn*ch; resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, True); i++; rn++; if(rn >= rows) { /* jump to the next column */ rn = 0; cn++; } } } void grid(Monitor *m) { unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows; Client *c; for(n = 0, c = nexttiled(selmon->clients); c; c = nexttiled(c->next)) n++; /* grid dimensions */ for(rows = 0; rows <= n/2; rows++) if(rows*rows >= n) break; cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows; /* window geoms (cell height/width) */ ch = m->wh / (rows ? rows : 1); cw = m->ww / (cols ? cols : 1); for(i = 0, c = nexttiled(selmon->clients); c; c = nexttiled(c->next)) { cx = m->wx + (i / rows) * cw; cy = m->wy + (i % rows) * ch; /* adjust height/width of last row/column's windows */ ah = ((i + 1) % rows == 0) ? m->wh - ch * rows : 0; aw = (i >= rows * (cols - 1)) ? m->ww - cw * cols : 0; resize(c, cx, cy, cw - 2 * c->bw + aw, ch - 2 * c->bw + ah, True); i++; } } 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 *c; if(!selmon->sel || selmon->sel->isfloating) return; if((c = prevtiled(selmon->sel))) { /* attach before c */ detach(selmon->sel); selmon->sel->next = c; if(selmon->clients == c) selmon->clients = selmon->sel; else { for(c = selmon->clients; c->next != selmon->sel->next; c = c->next); c->next = selmon->sel; } } else { /* move to the end */ for(c = selmon->sel; c->next; c = c->next); detach(selmon->sel); selmon->sel->next = NULL; c->next = selmon->sel; } focus(selmon->sel); arrange(); } static void pushdown(const Arg *arg) { Client *c; if(!selmon->sel || selmon->sel->isfloating) return; if((c = nexttiled(selmon->sel->next))) { /* attach after c */ detach(selmon->sel); selmon->sel->next = c->next; c->next = selmon->sel; } else { /* move to the front */ detach(selmon->sel); attach(selmon->sel); } focus(selmon->sel); arrange(); } void insertbefore(Client *a, Client *b) /* insert a before b in the client list */ { Client **x = &selmon->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; XEvent ev; int x, y; Bool after; if(!(c = selmon->sel)) return; 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(selmon->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(); break; } } } } while(ev.type != ButtonRelease); XUngrabPointer(dpy, CurrentTime); }
Re: [dev] [dwm] pertag and bstack for 5.6 release
On Wed, Jul 15, 2009 at 06:48:25PM +0200, Moritz Lipp wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hello, > I have adapted some patches for dwm 5.6 yesterday, amongst that also > pertag and bstack, but I did not had the time to test them well. Since you > have added your patches, I will just add the others I've edited: > gaplessgrid, > grid, push and tilemovemouse. Thanks! Attached is an update of the very simple focusurgent patch. void focusurgent(Arg *x) { Client *c; for(c = selmon->stack; c && !(c->isurgent); c = c->snext); if(c) { Arg a; a.ui=c->tags; view(&a); focus(c); } }
Re: [dev] [dwm] pertag and bstack for 5.6 release
On 7/15/09, Moritz Lipp wrote: > have added your patches, I will just add the others I've edited: > gaplessgrid, > grid, push and tilemovemouse. gapless grid and push is already available on the suckless wiki. i'd recommend uploading the patches to the wiki once they are well tested the preferred format is a .c file with a short description and example config.h lines see eg http://dwm.suckless.org/patches/push
[dev] dwm-5.6 focusstack broken
Using the dwm-5.6 tarball from dwm.suckless.org, focusstack only works when in monocle or floating. When trying to focus a client in the stack, dwm jumps back to the master. I'm not using any patch's. -- Jake Todd // If it isn't broke, tweak it! pgpmVzsbRRIjq.pgp Description: PGP signature