Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.5 KiB

4 years ago
  1. From c32a879432573d71dec7fcb4bf68927d2f4cdf10 Mon Sep 17 00:00:00 2001
  2. From: iofq <cjriddz@protonmail.com>
  3. Date: Sat, 12 Sep 2020 22:28:09 -0500
  4. Subject: [PATCH] Fixed 'cfacts' patch failure due to upstream commit
  5. 'f09418bbb...'
  6. ---
  7. config.def.h | 3 +++
  8. dwm.c | 34 +++++++++++++++++++++++++++++++---
  9. 2 files changed, 34 insertions(+), 3 deletions(-)
  10. diff --git a/config.def.h b/config.def.h
  11. index 1c0b587..83910c1 100644
  12. --- a/config.def.h
  13. +++ b/config.def.h
  14. @@ -70,6 +70,9 @@ static Key keys[] = {
  15. { MODKEY, XK_d, incnmaster, {.i = -1 } },
  16. { MODKEY, XK_h, setmfact, {.f = -0.05} },
  17. { MODKEY, XK_l, setmfact, {.f = +0.05} },
  18. + { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
  19. + { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
  20. + { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
  21. { MODKEY, XK_Return, zoom, {0} },
  22. { MODKEY, XK_Tab, view, {0} },
  23. { MODKEY|ShiftMask, XK_c, killclient, {0} },
  24. diff --git a/dwm.c b/dwm.c
  25. index 664c527..5233229 100644
  26. --- a/dwm.c
  27. +++ b/dwm.c
  28. @@ -87,6 +87,7 @@ typedef struct Client Client;
  29. struct Client {
  30. char name[256];
  31. float mina, maxa;
  32. + float cfact;
  33. int x, y, w, h;
  34. int oldx, oldy, oldw, oldh;
  35. int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  36. @@ -201,6 +202,7 @@ static void setclientstate(Client *c, long state);
  37. static void setfocus(Client *c);
  38. static void setfullscreen(Client *c, int fullscreen);
  39. static void setlayout(const Arg *arg);
  40. +static void setcfact(const Arg *arg);
  41. static void setmfact(const Arg *arg);
  42. static void setup(void);
  43. static void seturgent(Client *c, int urg);
  44. @@ -1030,6 +1032,7 @@ manage(Window w, XWindowAttributes *wa)
  45. c->w = c->oldw = wa->width;
  46. c->h = c->oldh = wa->height;
  47. c->oldbw = wa->border_width;
  48. + c->cfact = 1.0;
  49. updatetitle(c);
  50. if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
  51. @@ -1512,6 +1515,23 @@ setlayout(const Arg *arg)
  52. drawbar(selmon);
  53. }
  54. +void setcfact(const Arg *arg) {
  55. + float f;
  56. + Client *c;
  57. +
  58. + c = selmon->sel;
  59. +
  60. + if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
  61. + return;
  62. + f = arg->f + c->cfact;
  63. + if(arg->f == 0.0)
  64. + f = 1.0;
  65. + else if(f < 0.25 || f > 4.0)
  66. + return;
  67. + c->cfact = f;
  68. + arrange(selmon);
  69. +}
  70. +
  71. /* arg > 1.0 will set mfact absolutely */
  72. void
  73. setmfact(const Arg *arg)
  74. @@ -1675,9 +1695,15 @@ void
  75. tile(Monitor *m)
  76. {
  77. unsigned int i, n, h, mw, my, ty;
  78. + float mfacts = 0, sfacts = 0;
  79. Client *c;
  80. - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  81. + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
  82. + if (n < m->nmaster)
  83. + mfacts += c->cfact;
  84. + else
  85. + sfacts += c->cfact;
  86. + }
  87. if (n == 0)
  88. return;
  89. @@ -1687,15 +1713,17 @@ tile(Monitor *m)
  90. mw = m->ww;
  91. for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  92. if (i < m->nmaster) {
  93. - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
  94. + h = (m->wh - my) * (c->cfact / mfacts);
  95. resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
  96. if (my + HEIGHT(c) < m->wh)
  97. my += HEIGHT(c);
  98. + mfacts -= c->cfact;
  99. } else {
  100. - h = (m->wh - ty) / (n - i);
  101. + h = (m->wh - ty) * (c->cfact / sfacts);
  102. resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
  103. if (ty + HEIGHT(c) < m->wh)
  104. ty += HEIGHT(c);
  105. + sfacts -= c->cfact;
  106. }
  107. }
  108. --
  109. 2.28.0