Advertisement
Guest User

dwm-barborder-chadwm-6.2.diff

a guest
Jul 21st, 2021
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. diff --git a/chadwm/config.def.h b/chadwm/config.def.h
  2. index 72a34eb..2d26eca 100644
  3. --- a/chadwm/config.def.h
  4. +++ b/chadwm/config.def.h
  5. @@ -9,6 +9,8 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails,display s
  6. static const int showsystray = 1; /* 0 means no systray */
  7. static const int showbar = 1; /* 0 means no bar */
  8. static const int topbar = 1; /* 0 means bottom bar */
  9. +static const int vertpad = 10; /* vertical padding of bar */
  10. +static const int sidepad = 10; /* horizontal padding of bar */
  11. static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
  12. static const int horizpadbar = 10;
  13. static const int vertpadbar = 10;
  14. diff --git a/chadwm/dwm.c b/chadwm/dwm.c
  15. index 06798c6..50f473f 100644
  16. --- a/chadwm/dwm.c
  17. +++ b/chadwm/dwm.c
  18. @@ -291,6 +291,8 @@ static int screen;
  19. static int sw, sh; /* X display screen geometry width, height */
  20. static int bh, blw = 0; /* bar geometry */
  21. static int lrpad; /* sum of left and right padding for text */
  22. +static int vp; /* vertical padding for bar */
  23. +static int sp; /* side padding for bar */
  24. static int (*xerrorxlib)(Display *, XErrorEvent *);
  25. static unsigned int numlockmask = 0;
  26. static void (*handler[LASTEvent]) (XEvent *) = {
  27. @@ -863,8 +865,8 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
  28. text = p;
  29.  
  30. w += horizpadbar;
  31. - ret = x = m->ww - borderpx - w;
  32. - x = m->ww - borderpx - w - getsystraywidth();
  33. + ret = x = m->ww - sp * 2 - borderpx - w;
  34. + x = m->ww - sp * 2 - borderpx - w - getsystraywidth();
  35.  
  36. drw_setscheme(drw, scheme[LENGTH(colors)]);
  37. drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
  38. @@ -1236,14 +1238,14 @@ drawbar(Monitor *m)
  39. {
  40. int x, y = borderpx, w, sw = 0, stw = 0;
  41. int th = bh - borderpx * 2;
  42. - int mw = m->ww - borderpx * 2;
  43. + int mw = m->ww - sp * 2 - borderpx * 2;
  44. int boxs = drw->fonts->h / 9;
  45. int boxw = drw->fonts->h / 6 + 2;
  46. unsigned int i, occ = 0, urg = 0;
  47. Client *c;
  48.  
  49. XSetForeground(drw->dpy, drw->gc, clrborder.pixel);
  50. - XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww, bh);
  51. + XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww - sp * 2, bh);
  52.  
  53. if(showsystray && m == systraytomon(m))
  54.  
  55. @@ -1275,14 +1277,14 @@ drawbar(Monitor *m)
  56. drw_setscheme(drw, scheme[SchemeNorm]);
  57. x = drw_text(drw, x, y, w, th, lrpad / 2, m->ltsymbol, 0);
  58.  
  59. - if ((w = mw - sw - stw - x) > th) {
  60. + if ((w = mw + sp * 2 - sw - stw - x) > th) {
  61. if (m->sel) {
  62. drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
  63. if (m->sel->isfloating)
  64. drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0);
  65. } else {
  66. drw_setscheme(drw, scheme[SchemeNorm]);
  67. - drw_rect(drw, x, y, w, th, 1, 1);
  68. + drw_rect(drw, x, y, w - sp * 2, th, 1, 1);
  69. }
  70. }
  71. drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
  72. @@ -1890,10 +1892,10 @@ resize(Client *c, int x, int y, int w, int h, int interact)
  73.  
  74. void
  75. resizebarwin(Monitor *m) {
  76. - unsigned int w = m->ww;
  77. + unsigned int w = m->ww - 2 * sp;
  78. if (showsystray && m == systraytomon(m))
  79. w -= getsystraywidth();
  80. - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
  81. + XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, w, bh);
  82. }
  83.  
  84. void
  85. @@ -2253,6 +2255,8 @@ setup(void)
  86. lrpad = drw->fonts->h;
  87. bh = user_bh ? user_bh : drw->fonts->h + 2 + vertpadbar + borderpx * 2;
  88. updategeom();
  89. + sp = sidepad;
  90. + vp = (topbar == 1) ? vertpad : - vertpad;
  91. /* init atoms */
  92. utf8string = XInternAtom(dpy, "UTF8_STRING", False);
  93. wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
  94. @@ -2292,6 +2296,7 @@ setup(void)
  95. /* init bars */
  96. updatebars();
  97. updatestatus();
  98. + updatebarpos(selmon);
  99. /* supporting window for NetWMCheck */
  100. wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
  101. XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
  102. @@ -2546,7 +2551,7 @@ updatebars(void)
  103. w = m->ww;
  104. if (showsystray && m == systraytomon(m))
  105. w -= getsystraywidth();
  106. - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
  107. + m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, w - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
  108. CopyFromParent, DefaultVisual(dpy, screen),
  109. CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
  110. XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
  111. @@ -2563,11 +2568,11 @@ updatebarpos(Monitor *m)
  112. m->wy = m->my;
  113. m->wh = m->mh;
  114. if (m->showbar) {
  115. - m->wh -= bh;
  116. - m->by = m->topbar ? m->wy : m->wy + m->wh;
  117. - m->wy = m->topbar ? m->wy + bh : m->wy;
  118. + m->wh = m->wh - vertpad - bh;
  119. + m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
  120. + m->wy = m->topbar ? m->wy + bh + vp : m->wy;
  121. } else
  122. - m->by = -bh;
  123. + m->by = -bh - vp;
  124. }
  125.  
  126. void
  127.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement