dwm

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

transfer.c (937B)


      1 void
      2 transfer(const Arg *arg)
      3 {
      4 	Client *c, *mtail = selmon->clients, *stail = NULL, *insertafter;
      5 	int transfertostack = 0, i, nmasterclients;
      6 
      7 	for (i = 0, c = selmon->clients; c; c = c->next) {
      8 		if (!ISVISIBLE(c) || c->isfloating) continue;
      9 		if (selmon->sel == c) { transfertostack = i < selmon->nmaster && selmon->nmaster != 0; }
     10 		if (i < selmon->nmaster) { nmasterclients++; mtail = c; }
     11 		stail = c;
     12 		i++;
     13 	}
     14 	if (!selmon->sel || selmon->sel->isfloating || i == 0) {
     15 		return;
     16 	} else if (transfertostack) {
     17 		selmon->nmaster = MIN(i, selmon->nmaster) - 1;
     18 		insertafter = stail;
     19 	} else {
     20 		selmon->nmaster = selmon->nmaster + 1;
     21 		insertafter = mtail;
     22 	}
     23 	if (insertafter != selmon->sel) {
     24 		detach(selmon->sel);
     25 		if (selmon->nmaster == 1 && !transfertostack) {
     26 		 attach(selmon->sel); // Head prepend case
     27 		} else {
     28 			selmon->sel->next = insertafter->next;
     29 			insertafter->next = selmon->sel;
     30 		}
     31 	}
     32 	arrange(selmon);
     33 }
     34