comparison config/dwm/dwm.c.orig @ 2:a2c891f7b914

Occasional commit 2
author Yasuri <yasuri@charliesmp.net>
date Sat, 03 Oct 2026 18:53:08 -0500
parents face7f4d84f7
children
comparison
equal deleted inserted replaced
1:f78c8a98f113 2:a2c891f7b914
84 typedef struct Monitor Monitor; 84 typedef struct Monitor Monitor;
85 typedef struct Client Client; 85 typedef struct Client Client;
86 struct Client { 86 struct Client {
87 char name[256]; 87 char name[256];
88 float mina, maxa; 88 float mina, maxa;
89 float cfact;
89 int x, y, w, h; 90 int x, y, w, h;
90 int oldx, oldy, oldw, oldh; 91 int oldx, oldy, oldw, oldh;
91 int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; 92 int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
92 int bw, oldbw; 93 int bw, oldbw;
93 unsigned int tags; 94 unsigned int tags;
116 int nmaster; 117 int nmaster;
117 int num; 118 int num;
118 int by; /* bar geometry */ 119 int by; /* bar geometry */
119 int mx, my, mw, mh; /* screen size */ 120 int mx, my, mw, mh; /* screen size */
120 int wx, wy, ww, wh; /* window area */ 121 int wx, wy, ww, wh; /* window area */
122 int gappih; /* horizontal gap between windows */
123 int gappiv; /* vertical gap between windows */
124 int gappoh; /* horizontal outer gaps */
125 int gappov; /* vertical outer gaps */
121 unsigned int seltags; 126 unsigned int seltags;
122 unsigned int sellt; 127 unsigned int sellt;
123 unsigned int tagset[2]; 128 unsigned int tagset[2];
124 int showbar; 129 int showbar;
125 int topbar; 130 int topbar;
198 static void sendmon(Client *c, Monitor *m); 203 static void sendmon(Client *c, Monitor *m);
199 static void setclientstate(Client *c, long state); 204 static void setclientstate(Client *c, long state);
200 static void setfocus(Client *c); 205 static void setfocus(Client *c);
201 static void setfullscreen(Client *c, int fullscreen); 206 static void setfullscreen(Client *c, int fullscreen);
202 static void setlayout(const Arg *arg); 207 static void setlayout(const Arg *arg);
208 static void setcfact(const Arg *arg);
203 static void setmfact(const Arg *arg); 209 static void setmfact(const Arg *arg);
204 static void setup(void); 210 static void setup(void);
205 static void seturgent(Client *c, int urg); 211 static void seturgent(Client *c, int urg);
206 static void showhide(Client *c); 212 static void showhide(Client *c);
207 static void spawn(const Arg *arg); 213 static void spawn(const Arg *arg);
208 static void tag(const Arg *arg); 214 static void tag(const Arg *arg);
209 static void tagmon(const Arg *arg); 215 static void tagmon(const Arg *arg);
210 static void tile(Monitor *m);
211 static void togglebar(const Arg *arg); 216 static void togglebar(const Arg *arg);
212 static void togglefloating(const Arg *arg); 217 static void togglefloating(const Arg *arg);
213 static void toggletag(const Arg *arg); 218 static void toggletag(const Arg *arg);
214 static void toggleview(const Arg *arg); 219 static void toggleview(const Arg *arg);
215 static void unfocus(Client *c, int setfocus); 220 static void unfocus(Client *c, int setfocus);
638 m->tagset[0] = m->tagset[1] = 1; 643 m->tagset[0] = m->tagset[1] = 1;
639 m->mfact = mfact; 644 m->mfact = mfact;
640 m->nmaster = nmaster; 645 m->nmaster = nmaster;
641 m->showbar = showbar; 646 m->showbar = showbar;
642 m->topbar = topbar; 647 m->topbar = topbar;
648 m->gappih = gappih;
649 m->gappiv = gappiv;
650 m->gappoh = gappoh;
651 m->gappov = gappov;
643 m->lt[0] = &layouts[0]; 652 m->lt[0] = &layouts[0];
644 m->lt[1] = &layouts[1 % LENGTH(layouts)]; 653 m->lt[1] = &layouts[1 % LENGTH(layouts)];
645 strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); 654 strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
646 return m; 655 return m;
647 } 656 }
1041 c->x = c->oldx = wa->x; 1050 c->x = c->oldx = wa->x;
1042 c->y = c->oldy = wa->y; 1051 c->y = c->oldy = wa->y;
1043 c->w = c->oldw = wa->width; 1052 c->w = c->oldw = wa->width;
1044 c->h = c->oldh = wa->height; 1053 c->h = c->oldh = wa->height;
1045 c->oldbw = wa->border_width; 1054 c->oldbw = wa->border_width;
1055 c->cfact = 1.0;
1046 1056
1047 updatetitle(c); 1057 updatetitle(c);
1048 if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { 1058 if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
1049 c->mon = t->mon; 1059 c->mon = t->mon;
1050 c->tags = t->tags; 1060 c->tags = t->tags;
1517 strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); 1527 strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
1518 if (selmon->sel) 1528 if (selmon->sel)
1519 arrange(selmon); 1529 arrange(selmon);
1520 else 1530 else
1521 drawbar(selmon); 1531 drawbar(selmon);
1532 }
1533
1534 void
1535 setcfact(const Arg *arg) {
1536 float f;
1537 Client *c;
1538
1539 c = selmon->sel;
1540
1541 if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
1542 return;
1543 f = arg->f + c->cfact;
1544 if(arg->f == 0.0)
1545 f = 1.0;
1546 else if(f < 0.25 || f > 4.0)
1547 return;
1548 c->cfact = f;
1549 arrange(selmon);
1522 } 1550 }
1523 1551
1524 /* arg > 1.0 will set mfact absolutely */ 1552 /* arg > 1.0 will set mfact absolutely */
1525 void 1553 void
1526 setmfact(const Arg *arg) 1554 setmfact(const Arg *arg)
1683 return; 1711 return;
1684 sendmon(selmon->sel, dirtomon(arg->i)); 1712 sendmon(selmon->sel, dirtomon(arg->i));
1685 } 1713 }
1686 1714
1687 void 1715 void
1688 tile(Monitor *m)
1689 {
1690 unsigned int i, n, h, mw, my, ty;
1691 Client *c;
1692
1693 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
1694 if (n == 0)
1695 return;
1696
1697 if (n > m->nmaster)
1698 mw = m->nmaster ? m->ww * m->mfact : 0;
1699 else
1700 mw = m->ww;
1701 for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
1702 if (i < m->nmaster) {
1703 h = (m->wh - my) / (MIN(n, m->nmaster) - i);
1704 resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
1705 if (my + HEIGHT(c) < m->wh)
1706 my += HEIGHT(c);
1707 } else {
1708 h = (m->wh - ty) / (n - i);
1709 resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
1710 if (ty + HEIGHT(c) < m->wh)
1711 ty += HEIGHT(c);
1712 }
1713 }
1714
1715 void
1716 togglebar(const Arg *arg) 1716 togglebar(const Arg *arg)
1717 { 1717 {
1718 selmon->showbar = !selmon->showbar; 1718 selmon->showbar = !selmon->showbar;
1719 updatebarpos(selmon); 1719 updatebarpos(selmon);
1720 XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); 1720 XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);