dwm

Kris's build of dwm
git clone git clone https://git.krisyotam.com/krisyotam/dwm.git
Log | Files | Refs | README | LICENSE

rotatestack.c (776B)


      1 void
      2 enqueue(Client *c)
      3 {
      4 	Client *l;
      5 	for (l = c->mon->clients; l && l->next; l = l->next);
      6 	if (l) {
      7 		l->next = c;
      8 		c->next = NULL;
      9 	}
     10 }
     11 
     12 void
     13 enqueuestack(Client *c)
     14 {
     15 	Client *l;
     16 	for (l = c->mon->stack; l && l->snext; l = l->snext);
     17 	if (l) {
     18 		l->snext = c;
     19 		c->snext = NULL;
     20 	}
     21 }
     22 
     23 void
     24 rotatestack(const Arg *arg)
     25 {
     26 	Client *c = NULL, *f;
     27 
     28 	if (!selmon->sel)
     29 		return;
     30 	f = selmon->sel;
     31 	if (arg->i > 0) {
     32 		for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
     33 		if (c){
     34 			detach(c);
     35 			attach(c);
     36 			detachstack(c);
     37 			attachstack(c);
     38 		}
     39 	} else {
     40 		if ((c = nexttiled(selmon->clients))){
     41 			detach(c);
     42 			enqueue(c);
     43 			detachstack(c);
     44 			enqueuestack(c);
     45 		}
     46 	}
     47 	if (c){
     48 		arrange(selmon);
     49 		focus(f);
     50 		restack(selmon);
     51 	}
     52 }
     53