[dwm] minor cleanup
Hi, Attached are two minuscule patches. The first (clean.diff) removes a switch statement in event.c with only one case. The second (spell.diff) fixes a spelling mistake by me in the shiftview comment. Regards, -- Jeroen Schot [EMAIL PROTECTED] (mail & jabber) http://schot.a-eskwadraat.nl diff -r 5b1caaa31aba event.c --- a/event.c Tue Jul 24 18:29:29 2007 +0200 +++ b/event.c Tue Jul 24 22:50:48 2007 +0200 @@ -142,12 +142,8 @@ buttonpress(XEvent *e) { return; } } - if(ev->x < x + blw) - switch(ev->button) { - case Button1: - setlayout(NULL); - break; - } + if(ev->x < x + blw && ev->button == Button1) + setlayout(NULL); else if(ev->button == Button4) focusclient("-1"); else if(ev->button == Button5) diff -r 5b1caaa31aba tag.c --- a/tag.c Tue Jul 24 18:29:29 2007 +0200 +++ b/tag.c Wed Jul 25 01:21:19 2007 +0200 @@ -106,7 +106,7 @@ shiftview(const char *arg) { for(i = 0; !seltag[i]; i++); for(j = i + 1; j < ntags && !seltag[j]; j++); if(j < ntags) - return; /* more then one tag selected */ + return; /* more than one tag selected */ seltag[i] = False; i += arg ? atoi(arg) : 0; if(i < 0)
Re: [dwm] spiral tiling layout
Hi, On Tue, Jul 24, 2007 at 06:40:56PM +0200, Anselm R. Garbe wrote: > Two issues. You don't need to declare spiral in dwm.h, it should > be fine to declare it static in layout.c just before tile(). Ok, thanks. I'm basically learning c by hacking on dwm ;) > Second, this layout seems to be broken if you run a lot of > windows, then there is no fallback to prevent 0-pixel window > heights/widths (in tile layout all stacked windows will be > maximized, same if you increase NMASTER to something > insane). Not enough cornercase testing done. I will look at something similar to the tile() code. On Tue, Jul 24, 2007 at 07:00:48PM +0200, pancake wrote: > I will try it asap. Can you upload this patch to? > > http://www.suckless.org/wiki/dwm/patches Now on http://www.suckless.org/wiki/dwm/patches/spiral, not including Anselm's suggestions (yet). Regards, -- Jeroen Schot [EMAIL PROTECTED] (mail & jabber) http://schot.a-eskwadraat.nl
Re: [dwm] spiral tiling layout
On Tue, Jul 24, 2007 at 04:13:08PM +0200, Jeroen Schot wrote: > Hi, > > I stumbled upon the list of Xmonad extensions[1] and saw a spiral tiling > layout > there. Attached is the resulting patch that implements something similar for > dwm. > > A quick ascii-art representation: > > +---+---+ > | | | > | | | > | | | > | +--+--+-+ > | | |-+| | > | +--+--+ | > | | | | > +---+-+-+ > > [1]: http://www.xmonad.org/contrib.html Two issues. You don't need to declare spiral in dwm.h, it should be fine to declare it static in layout.c just before tile(). Second, this layout seems to be broken if you run a lot of windows, then there is no fallback to prevent 0-pixel window heights/widths (in tile layout all stacked windows will be maximized, same if you increase NMASTER to something insane). Regards, -- Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Re: [dwm] spiral tiling layout
> A quick ascii-art representation: > > +---+---+ > | | | > | | | > | | | > | +--+--+-+ > | | |-+| | > | +--+--+ | > | | | | > +---+-+-+ very cool - works great. .. ive always thought the ultimate would be some kind of squarified voronoi: http://www.cs.umd.edu/hcil/treemap-history/ , automatically removing the tag of a window if it wasnt used for a while..with the size of the window determined by use frequency, CPU time of contained processes (proably not possible with X..) cheers > > [1]: http://www.xmonad.org/contrib.html
Re: [dwm] spiral tiling layout
Uhm :) Interesting (not only for visual enjoyment) layout. I will try it asap. Can you upload this patch to? http://www.suckless.org/wiki/dwm/patches On Tue, Jul 24, 2007 at 04:13:08PM +0200, Jeroen Schot wrote: > Hi, > > I stumbled upon the list of Xmonad extensions[1] and saw a spiral tiling > layout > there. Attached is the resulting patch that implements something similar for > dwm. > > A quick ascii-art representation: > > +---+---+ > | | | > | | | > | | | > | +--+--+-+ > | | |-+| | > | +--+--+ | > | | | | > +---+-+-+ > > [1]: http://www.xmonad.org/contrib.html > > Regards, > -- > Jeroen Schot > > [EMAIL PROTECTED] (mail & jabber) > http://schot.a-eskwadraat.nl
[dwm] spiral tiling layout
Hi, I stumbled upon the list of Xmonad extensions[1] and saw a spiral tiling layout there. Attached is the resulting patch that implements something similar for dwm. A quick ascii-art representation: +---+---+ | | | | | | | | | | +--+--+-+ | | |-+| | | +--+--+ | | | | | +---+-+-+ [1]: http://www.xmonad.org/contrib.html Regards, -- Jeroen Schot [EMAIL PROTECTED] (mail & jabber) http://schot.a-eskwadraat.nl diff -up dwm.orig/config.default.h dwm/config.default.h --- dwm.orig/config.default.h 2007-07-23 21:37:29.0 +0200 +++ dwm/config.default.h 2007-07-24 15:43:59.0 +0200 @@ -30,6 +30,7 @@ static Layout layout[] = { \ /* symbol function */ \ { "[]=", tile }, /* first entry is default */ \ { "><>", floating }, \ + { "(@)", spiral }, \ }; #define MASTERWIDTH 600 /* master width per thousand */ #define NMASTER 1 /* clients in master area */ diff -up dwm.orig/dwm.h dwm/dwm.h --- dwm.orig/dwm.h 2007-07-23 21:37:29.0 +0200 +++ dwm/dwm.h 2007-07-24 15:43:29.0 +0200 @@ -127,6 +127,7 @@ void initlayouts(void); /* initialize Client *nexttiled(Client *c); /* returns tiled successor of c */ void restack(void); /* restores z layers of all clients */ void setlayout(const char *arg); /* sets layout, NULL means next layout */ +void spiral(void); /* arranges all windows in a spiral */ void togglebar(const char *arg); /* shows/hides the bar */ void togglemax(const char *arg); /* toggles maximization of floating client */ void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */ diff -up dwm.orig/layout.c dwm/layout.c --- dwm.orig/layout.c 2007-07-23 21:37:29.0 +0200 +++ dwm/layout.c 2007-07-24 15:46:42.0 +0200 @@ -211,6 +211,50 @@ setlayout(const char *arg) { } void +spiral(void) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + nx = wax; + ny = way + wah; + nh = wah; + nw = waw; + for(i = 0, c = clients; c; c = c->next) + if(isvisible(c)) { + unban(c); + if(c->isfloating) +continue; + c->ismax = False; + if(i < n - 1) { +if(i % 2 == 0) + nw /= 2; +else + nh /= 2; +if(i % 4 == 2) + nx += nw; +else if(i % 4 == 3) + ny += nh; + } + if(i % 4 == 0) +ny -= nh; + else if(i % 4 == 1) +nx += nw; + else if(i % 4 == 2) +ny += nh; + else +nx -= nw; + resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c ->border, False); + i++; + } + else + ban(c); + focus(NULL); + restack(); +} + +void togglebar(const char *arg) { if(bpos == BarOff) bpos = (BARPOS == BarOff) ? BarTop : BARPOS;