On Thu, 4 Dec 2008 20:37:38 +0000
"Anselm R Garbe" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> there was some silence during the last weeks, simply because I am/was
> rather busy but also because I'm working on a secret surprise project
> (yes it's st related). But I won't tell anything about it yet -- I
> hope to disclose the details at 25C3 in Berlin in a couple of weeks ;)
>
> Anyway, it's time for a new dwm release, you can fetch it from
>
> http://code.suckless.org/dl/dwm/dwm-5.3.tar.gz
>
> This release contains the spawn() version of Neale and several
> bugfixes regarding the NOBORDER handling in 5.2, and a new config.h
> option which allows to set use server grabs during mouse based
> resizals/movements.
>
> Let me know any issues.
>
> Kind regards,
> --Anselm
>
Hi,
As usual this is the dwmii patch for dwm-5.3.
I think I have an issue when quitting dwm : If windows are openned
(xterm, claws-mail, firefox, pidgin for example) then X won't shut down
until I close (when possible) the windows. Does this have to do with
the new "simple-fork" ? I did not havs that issue with the previous
version of dwm.
--
Kind regards,
Guillaume Quintin.
/*
* I used WMII and found it too "heavy". So I switched to dwm but I
* quickly missed the possibilities of having several columns,
* several windows in each column and moving the windows from a
* column into another or change the windows' order within a column.
* As there were no patch (or layout) providing that, I wrote one.
* I also added a layout that does the same thing but arrange the
* windows by rows.
*
* The col dwmii layout :
*
* +--+--+--+
* | | | |
* +--+ | |
* | +--+ |
* +--+ | |
* | | | |
* +--+--+--+
*
* The row dwmii layout :
*
* +--+---+--+
* | | | |
* +--+-+-+--+
* | | |
* +----+----+
* | |
* +---------+
*
* You can move a window to the next/previous columnn, after the next
* window or before the previous window within a column by simple
* combination of keys (the same as in WMII). Moreover, you can choose
* the layout to respect the mfact or not. By default it does not, and
* MODKEY + SHIFT + M will change this behavior.
*
* To get the dwmii layouts working you have to :
* - have DWM version 5.3
* - add these lines in the config.h file :
* - just before the layouts array :
*
* #include "dwmii.c"
*
* - in the layouts array :
*
* { "COL", dwmiilayoutcol },
* { "ROW", dwmiilayoutrow },
*
* - in the keys array :
*
* { MODKEY, XK_c, setlayout, {.v = &layouts[1]} },
* { MODKEY, XK_r, setlayout, {.v = &layouts[2]} },
* { MODKEY|ShiftMask, XK_Up, dwmiikeypressed, {.i = XK_Up} },
* { MODKEY|ShiftMask, XK_Left, dwmiikeypressed, {.i = XK_Left} },
* { MODKEY|ShiftMask, XK_Down, dwmiikeypressed, {.i = XK_Down} },
* { MODKEY|ShiftMask, XK_Right, dwmiikeypressed, {.i = XK_Right} },
* { MODKEY|ShiftMask, XK_n, dwmiitoggle, {0} },
* { MODKEY|ShiftMask, XK_m, dwmiimfact, {0} },
*
* - add this line in the Client struct definition in the dwm.c file :
*
* int dwmii;
*
* - compile and it should work !
*
* The dwmiitoggle sets the dwmii variable of a window, when
* the dwmii is non zero then the window marks the start of a
* new column/row depending on the layout used.
*
* Enjoy it and feel free to send me all your comments !
*
* QUINTIN Guillaume
*/
static void dwmiitoggle(const Arg *);
static void dwmiisetmfact(const Arg *);
static void dwmiiinsertafter(Client *,Client *,int);
static void dwmiikeypressed(const Arg *);
static void dwmiiresize(Client *,int,int,int *,int *,int,int);
static void dwmiilayoutcol(void);
static void dwmiilayoutrow(void);
int dwmiimfact = 0;
void dwmiitoggle(const Arg *arg)
{
if ( !lt[sellt]->arrange || (sel && sel->isfloating) ) { return; }
Client *firstclients = nexttiled(clients);
if ( sel == firstclients ) { return ; }
if ( sel->dwmii ) { sel->dwmii = 0; return; }
sel->dwmii = 1;
arrange();
}
void dwmiisetmfact(const Arg *arg)
{
dwmiimfact = !dwmiimfact;
arrange();
}
void dwmiiinsertafter(Client *c,Client *after,int dwmii)
{
if ( !c || !after ) { return; }
detach(c);
c->dwmii = dwmii;
c->next = after->next;
after->next = c;
}
void dwmiikeypressed(const Arg *arg)
{
if ( !lt[sellt]->arrange || (sel && sel->isfloating) ) { return; }
Client* firstclients = nexttiled(clients);
if ( ( (arg->i == XK_Up) && (lt[sellt]->arrange == dwmiilayoutcol) ) ||
( (arg->i == XK_Left) && (lt[sellt]->arrange == dwmiilayoutrow) ) )
{
if ( sel->dwmii ) { return; }
Client *t = firstclients,*s = 0;
for( ; t != sel ; s = t,t = nexttiled(t->next) );
sel->dwmii = s->dwmii;
dwmiiinsertafter(s,sel,0);
}
if ( ( (arg->i == XK_Right) && (lt[sellt]->arrange == dwmiilayoutcol) ) ||
( (arg->i == XK_Down) && (lt[sellt]->arrange == dwmiilayoutrow) ) )
{
Client *t = nexttiled(sel->next),*s = 0;
if ( !t ) { sel->dwmii = 1; arrange(); return; }
int i = 2;
for( ; t && ((i -= ( t->dwmii ? 1 : 0 )) > 0) ; s = t,t = nexttiled(t->next) );
if ( sel->dwmii ) { t = nexttiled(sel->next); if ( t ) { t->dwmii = 1; } }
dwmiiinsertafter(sel,s,( i == 2 ? 1 : 0 ));
}
if ( ( (arg->i == XK_Down) && (lt[sellt]->arrange == dwmiilayoutcol) ) ||
( (arg->i == XK_Right) && (lt[sellt]->arrange == dwmiilayoutrow) ) )
{
Client *t = nexttiled(sel->next);
if ( !t || t->dwmii ) { return; }
t->dwmii = sel->dwmii;
dwmiiinsertafter(sel,t,0);
}
if ( ( (arg->i == XK_Left) && (lt[sellt]->arrange == dwmiilayoutcol) ) ||
( (arg->i == XK_Up) && (lt[sellt]->arrange == dwmiilayoutrow) ) )
{
if ( sel == firstclients ) { return; }
Client *t = firstclients,*s = 0,*u = 0;
for( ; t != sel ; s = t,t = nexttiled(t->next),u = ( t->dwmii ? s : u) );
if ( !u ) { return; }
if ( sel->dwmii ) { t = nexttiled(sel->next); if ( t ) { t->dwmii = 1; } }
dwmiiinsertafter(sel,u,0);
}
arrange();
}
void dwmiiresize(Client *c,int x,int y,int *w,int *h,int nx,int ny)
{
*w = ( *w || (nx == 1) ? (ww - x + wx) / nx : mfact * (ww - wx) );
*h = ( *h || (ny == 1) ? (wh - y + wy) / ny : mfact * (wh - wy) );
resize(c,x,y,*w - 2 * c->bw,*h - 2 * c->bw,resizehints);
*w = c->w + 2 * c->bw;
*h = c->h + 2 * c->bw;
}
void dwmiilayoutcol(void)
{
Client *firstclients = nexttiled(clients);
if ( !firstclients || (lt[sellt]->arrange != dwmiilayoutcol) ) { return; }
firstclients->dwmii = 1;
Client *t = nexttiled(firstclients->next);
int nx = 1;
for( ; t ; nx += ( t->dwmii ? 1 : 0 ),t = nexttiled(t->next) );
int x = wx,dw = 0,w = 0,rm = dwmiimfact;
for ( t = firstclients ; t ; )
{
int ny = 1;
Client *s = nexttiled(t->next);
for( ; s && !s->dwmii ; ny++,s = nexttiled(s->next) );
int dh = 1,y = wy;
w = ( rm ? 0 : 1 );
dwmiiresize(t,x,y,&w,&dh,nx,ny);
dw = ( w > dw ? w : dw );
y += dh; ny--;
for( t = nexttiled(t->next) ; t && !t->dwmii ; t = nexttiled(t->next) )
{
w = ( rm ? 0 : 1 ); dh = 1;
dwmiiresize(t,x,y,&w,&dh,nx,ny);
dw = ( w > dw ? w : dw );
y += dh; ny--;
}
x += dw; nx--; dw = 0;
rm = 0;
}
}
void dwmiilayoutrow(void)
{
Client *firstclients = nexttiled(clients);
if ( !firstclients || (lt[sellt]->arrange != dwmiilayoutrow) ) { return; }
firstclients->dwmii = 1;
Client *t = nexttiled(firstclients->next);
int ny = 1;
for( ; t ; ny += ( t->dwmii ? 1 : 0 ),t = nexttiled(t->next) );
int y = wy,dh = 0,h = 0,rm = dwmiimfact;
for ( t = firstclients ; t ; )
{
int nx = 1;
Client *s = nexttiled(t->next);
for( ; s && !s->dwmii ; nx++,s = nexttiled(s->next) );
int dw = 1,x = wx;
h = ( rm ? 0 : 1 );
dwmiiresize(t,x,y,&dw,&h,nx,ny);
dh = ( h > dh ? h : dh );
x += dw; nx--;
for( t = nexttiled(t->next) ; t && !t->dwmii ; t = nexttiled(t->next) )
{
h = ( rm ? 0 : 1 ); dw = 1;
dwmiiresize(t,x,y,&dw,&h,nx,ny);
dh = ( h > dh ? h : dh);
x += dw; nx--;
}
y += dh; ny--; dh = 0;
rm = 0;
}
}