Guest User

Untitled

a guest
Jan 23rd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. windowarea_margin patch for dwm 5.9
  2.  
  3. Introduce margin around the "window area", to eliminate "double gaps" between
  4. client windows by doubling it on the window area edges too.
  5. m->gap is the gap in pixel around window area and client windows.
  6. The default value of this gap should be defined in config.h:
  7.  
  8. static const unsigned int gappx = 3;
  9.  
  10. Note that due to "double gaps", the gaps you see are the double size of gappx.
  11.  
  12. diff -up a/dwm.c b/dwm.c
  13. --- a/dwm.c 2011-08-29 12:00:00.00 +0000
  14. +++ b/dwm.c 2011-08-29 12:00:00.00 +0000
  15. @@ -125,6 +125,7 @@ typedef struct {
  16. struct Monitor {
  17. char ltsymbol[16];
  18. float mfact;
  19. + int gap;
  20. int num;
  21. int by; /* bar geometry */
  22. int mx, my, mw, mh; /* screen size */
  23. @@ -1773,12 +1774,16 @@ updatebars(void) {
  24.  
  25. void
  26. updatebarpos(Monitor *m) {
  27. - m->wy = m->my;
  28. - m->wh = m->mh;
  29. + m->wy = m->my + m->gap;
  30. + m->wh = m->mh - m->gap * 2;
  31. if(m->showbar) {
  32. m->wh -= bh;
  33. - m->by = m->topbar ? m->wy : m->wy + m->wh;
  34. - m->wy = m->topbar ? m->wy + bh : m->wy;
  35. + if(m->topbar) {
  36. + m->by = m->my;
  37. + m->wy += bh;
  38. + }
  39. + else
  40. + m->by = m->wy + m->wh + m->gap;
  41. }
  42. else
  43. m->by = -bh;
  44. @@ -1819,12 +1824,15 @@ updategeom(void) {
  45. || unique[i].width != m->mw || unique[i].height != m->mh))
  46. {
  47. dirty = True;
  48. + m->gap = gappx;
  49. m->num = i;
  50. m->mx = m->wx = unique[i].x_org;
  51. m->my = m->wy = unique[i].y_org;
  52. m->mw = m->ww = unique[i].width;
  53. m->mh = m->wh = unique[i].height;
  54. updatebarpos(m);
  55. + m->wx += m->gap;
  56. + m->ww -= m->gap * 2;
  57. }
  58. }
  59. else { /* less monitors available nn < n */
  60. @@ -1854,9 +1862,12 @@ updategeom(void) {
  61. mons = createmon();
  62. if(mons->mw != sw || mons->mh != sh) {
  63. dirty = True;
  64. + mons->gap = gappx;
  65. mons->mw = mons->ww = sw;
  66. mons->mh = mons->wh = sh;
  67. updatebarpos(mons);
  68. + mons->wx += mons->gap;
  69. + mons->ww -= mons->gap * 2;
  70. }
  71. }
  72. if(dirty) {
Add Comment
Please, Sign In to add comment