dwm-tilegap-6.0.diff 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. diff --git a/config.def.h b/config.def.h
  2. index 77ff358..14d2826 100644
  3. --- a/config.def.h
  4. +++ b/config.def.h
  5. @@ -9,6 +9,7 @@ static const char selbordercolor[] = "#005577";
  6. static const char selbgcolor[] = "#005577";
  7. static const char selfgcolor[] = "#eeeeee";
  8. static const unsigned int borderpx = 1; /* border pixel of windows */
  9. +static const unsigned int gappx = 18; /* gap pixel between windows */
  10. static const unsigned int snap = 32; /* snap pixel */
  11. static const Bool showbar = True; /* False means no bar */
  12. static const Bool topbar = True; /* False means bottom bar */
  13. diff --git a/dwm.c b/dwm.c
  14. index 1d78655..41c72ff 100644
  15. --- a/dwm.c
  16. +++ b/dwm.c
  17. @@ -1703,27 +1703,30 @@ textnw(const char *text, unsigned int len) {
  18. void
  19. tile(Monitor *m) {
  20. - unsigned int i, n, h, mw, my, ty;
  21. + unsigned int i, n, h, mw, my, ty, ns;
  22. Client *c;
  23. for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  24. if(n == 0)
  25. return;
  26. - if(n > m->nmaster)
  27. + if (n > m->nmaster) {
  28. mw = m->nmaster ? m->ww * m->mfact : 0;
  29. - else
  30. + ns = m->nmaster > 0 ? 2 : 1;
  31. + } else {
  32. mw = m->ww;
  33. - for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  34. + ns = 1;
  35. + }
  36. + for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  37. if(i < m->nmaster) {
  38. - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
  39. - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
  40. - my += HEIGHT(c);
  41. + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
  42. + resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
  43. + my += HEIGHT(c) + gappx;
  44. }
  45. else {
  46. - h = (m->wh - ty) / (n - i);
  47. - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
  48. - ty += HEIGHT(c);
  49. + h = (m->wh - ty) / (n - i) - gappx;
  50. + resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
  51. + ty += HEIGHT(c) + gappx;
  52. }
  53. }