pushup and pushdown that move the current selected client in the list.

regards,
 Mate

i cleaned up your code a bit
void
pushup(const char *arg) {
	Client *c;

	if(!sel || lt->arrange == floating || 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 {
		/* move to the end */
		for(c = sel; c->next; c = c->next);
		detach(sel);
		sel->prev = c;
		c->next = sel;
	}
	focus(sel);
	lt->arrange();
}

void
pushdown(const char *arg) {
	Client *c;

	if(!sel || lt->arrange == floating || 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);
	lt->arrange();
}

Reply via email to