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.

81 lines
2.7 KiB

4 years ago
  1. From 58a5ece9406ca6c90dc362617c065e4aac19417f Mon Sep 17 00:00:00 2001
  2. From: Cyril Cressent <cyril@cressent.org>
  3. Date: Wed, 3 Jul 2019 21:33:45 -0700
  4. Subject: [PATCH] Port the uselessgap patch to 6.2
  5. ---
  6. config.def.h | 1 +
  7. dwm.c | 36 ++++++++++++++++++++++++++++++------
  8. 2 files changed, 31 insertions(+), 6 deletions(-)
  9. diff --git a/config.def.h b/config.def.h
  10. index 1c0b587..b11471d 100644
  11. --- a/config.def.h
  12. +++ b/config.def.h
  13. @@ -2,6 +2,7 @@
  14. /* appearance */
  15. static const unsigned int borderpx = 1; /* border pixel of windows */
  16. +static const unsigned int gappx = 6; /* gaps between windows */
  17. static const unsigned int snap = 32; /* snap pixel */
  18. static const int showbar = 1; /* 0 means no bar */
  19. static const int topbar = 1; /* 0 means bottom bar */
  20. diff --git a/dwm.c b/dwm.c
  21. index 4465af1..4545e05 100644
  22. --- a/dwm.c
  23. +++ b/dwm.c
  24. @@ -52,8 +52,8 @@
  25. #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
  26. #define LENGTH(X) (sizeof X / sizeof X[0])
  27. #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
  28. -#define WIDTH(X) ((X)->w + 2 * (X)->bw)
  29. -#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
  30. +#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
  31. +#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
  32. #define TAGMASK ((1 << LENGTH(tags)) - 1)
  33. #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
  34. @@ -1276,13 +1276,37 @@ void
  35. resizeclient(Client *c, int x, int y, int w, int h)
  36. {
  37. XWindowChanges wc;
  38. + unsigned int n;
  39. + unsigned int gapoffset;
  40. + unsigned int gapincr;
  41. + Client *nbc;
  42. - c->oldx = c->x; c->x = wc.x = x;
  43. - c->oldy = c->y; c->y = wc.y = y;
  44. - c->oldw = c->w; c->w = wc.width = w;
  45. - c->oldh = c->h; c->h = wc.height = h;
  46. wc.border_width = c->bw;
  47. +
  48. + /* Get number of clients for the selected monitor */
  49. + for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++);
  50. +
  51. + /* Do nothing if layout is floating */
  52. + if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
  53. + gapincr = gapoffset = 0;
  54. + } else {
  55. + /* Remove border and gap if layout is monocle or only one client */
  56. + if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) {
  57. + gapoffset = 0;
  58. + gapincr = -2 * borderpx;
  59. + wc.border_width = 0;
  60. + } else {
  61. + gapoffset = gappx;
  62. + gapincr = 2 * gappx;
  63. + }
  64. + }
  65. +
  66. + c->oldx = c->x; c->x = wc.x = x + gapoffset;
  67. + c->oldy = c->y; c->y = wc.y = y + gapoffset;
  68. + c->oldw = c->w; c->w = wc.width = w - gapincr;
  69. + c->oldh = c->h; c->h = wc.height = h - gapincr;
  70. +
  71. XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
  72. configure(c);
  73. XSync(dpy, False);
  74. 2.22.0