On 12/1/07, Rickard Gustafsson <[EMAIL PROTECTED]> wrote:
> Something like swap has been posted before done by k-zed and Szabolcs
> Nagy. It was done for DWM 4.1 I think.
here is the pushup/pushdown code for dwm 4.7
(include push.c in config.h if you find it useful)
Client *
prevtiled(Client *c) {
for(; c && (c->isfloating || !isvisible(c)); c = c->prev);
return c;
}
void
pushup(const char *arg) {
Client *c;
if(!sel || !dozoom || sel->isfloating)
return;
if((c = prevtiled(sel->prev))) {
/* attach before c */
detach(sel);
sel->next = c;
sel->prev = c->prev;
c->prev = sel;
if(sel->prev)
sel->prev->next = sel;
else
clients = sel;
} else {
/* move to the end */
for(c = sel; c->next; c = c->next);
detach(sel);
sel->prev = c;
c->next = sel;
}
focus(sel);
arrange();
}
void
pushdown(const char *arg) {
Client *c;
if(!sel || !dozoom || sel->isfloating)
return;
if((c = nexttiled(sel->next))) {
/* attach after c */
detach(sel);
sel->prev = c;
sel->next = c->next;
c->next = sel;
if(sel->next)
sel->next->prev = sel;
} else {
/* move to the front */
detach(sel);
attach(sel);
}
focus(sel);
arrange();
}