dwm

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

tagswapmon.c (1671B)


      1 void
      2 tagswapmon(const Arg *arg)
      3 {
      4 	Monitor *m;
      5 	Client *c, *sc = NULL, *mc = NULL, *next;
      6 
      7 	if (!mons->next)
      8 		return;
      9 
     10 	m = dirtomon(arg->i);
     11 
     12 	for (c = selmon->clients; c; c = next) {
     13 		next = c->next;
     14 		if (!ISVISIBLE(c))
     15 			continue;
     16 		unfocus(c, 1, NULL);
     17 		detach(c);
     18 		detachstack(c);
     19 		c->next = sc;
     20 		sc = c;
     21 	}
     22 
     23 	for (c = m->clients; c; c = next) {
     24 		next = c->next;
     25 		if (!ISVISIBLE(c))
     26 			continue;
     27 		unfocus(c, 1, NULL);
     28 		detach(c);
     29 		detachstack(c);
     30 		c->next = mc;
     31 		mc = c;
     32 	}
     33 
     34 	for (c = sc; c; c = next) {
     35 		next = c->next;
     36 		c->mon = m;
     37 		c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
     38 		attach(c);
     39 		attachstack(c);
     40 		if (c->isfullscreen) {
     41 			#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
     42 			if (c->fakefullscreen != 1) {
     43 				resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
     44 				XRaiseWindow(dpy, c->win);
     45 			}
     46 			#elif !FAKEFULLSCREEN_PATCH
     47 			resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
     48 			XRaiseWindow(dpy, c->win);
     49 			#endif // FAKEFULLSCREEN_CLIENT_PATCH
     50 		}
     51 	}
     52 
     53 	for (c = mc; c; c = next) {
     54 		next = c->next;
     55 		c->mon = selmon;
     56 		c->tags = selmon->tagset[selmon->seltags]; /* assign tags of target monitor */
     57 		attach(c);
     58 		attachstack(c);
     59 		if (c->isfullscreen) {
     60 			#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
     61 			if (c->fakefullscreen != 1) {
     62 				resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
     63 				XRaiseWindow(dpy, c->win);
     64 			}
     65 			#elif !FAKEFULLSCREEN_PATCH
     66 			resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
     67 			XRaiseWindow(dpy, c->win);
     68 			#endif // FAKEFULLSCREEN_CLIENT_PATCH
     69 		}
     70 	}
     71 
     72 	arrange(NULL);
     73 	focus(NULL);
     74 }
     75