Advertisement
Guest User

dwm-patch-chadwm.diff

a guest
Jul 20th, 2021
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. diff --git a/chadwm/config.def.h b/chadwm/config.def.h
  2. index 4678f9f..72a34eb 100644
  3. --- a/chadwm/config.def.h
  4. +++ b/chadwm/config.def.h
  5. @@ -10,6 +10,8 @@ static const int showsystray = 1; /* 0 means no systray */
  6. static const int showbar = 1; /* 0 means no bar */
  7. static const int topbar = 1; /* 0 means bottom bar */
  8. static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
  9. +static const int horizpadbar = 10;
  10. +static const int vertpadbar = 10;
  11. static const char *fonts[] = { "monospace:size=10" };
  12. static const char dmenufont[] = "monospace:size=10";
  13. static const char col_gray1[] = "#222222";
  14. @@ -17,6 +19,7 @@ static const char col_gray2[] = "#444444";
  15. static const char col_gray3[] = "#bbbbbb";
  16. static const char col_gray4[] = "#eeeeee";
  17. static const char col_cyan[] = "#005577";
  18. +static const char col_borderbar[] = "#ff0000";
  19. static const char *colors[][3] = {
  20. /* fg bg border */
  21. [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
  22. diff --git a/chadwm/dwm.c b/chadwm/dwm.c
  23. index 77af8f4..06798c6 100644
  24. --- a/chadwm/dwm.c
  25. +++ b/chadwm/dwm.c
  26. @@ -314,7 +314,7 @@ static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
  27. static int restart = 0;
  28. static int running = 1;
  29. static Cur *cursor[CurLast];
  30. -static Clr **scheme;
  31. +static Clr **scheme, clrborder;
  32. static Display *dpy;
  33. static Drw *drw;
  34. static Monitor *mons, *selmon;
  35. @@ -862,15 +862,15 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
  36. isCode = 0;
  37. text = p;
  38.  
  39. - w += 2; /* 1px padding on both sides */
  40. - ret = x = m->ww - w;
  41. - x = m->ww - w - getsystraywidth();
  42. + w += horizpadbar;
  43. + ret = x = m->ww - borderpx - w;
  44. + x = m->ww - borderpx - w - getsystraywidth();
  45.  
  46. drw_setscheme(drw, scheme[LENGTH(colors)]);
  47. drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
  48. drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
  49. - drw_rect(drw, x, 0, w, bh, 1, 1);
  50. - x++;
  51. + drw_rect(drw, x, borderpx, w, bh, 1, 1);
  52. + x += horizpadbar / 2;
  53.  
  54. /* process status text */
  55. i = -1;
  56. @@ -880,7 +880,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
  57.  
  58. text[i] = '\0';
  59. w = TEXTW(text) - lrpad;
  60. - drw_text(drw, x, 0, w, bh, 0, text, 0);
  61. + drw_text(drw, x, borderpx + vertpadbar / 2, w, bh - vertpadbar, 0, text, 0);
  62.  
  63. x += w;
  64.  
  65. @@ -910,7 +910,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
  66. while (text[++i] != ',');
  67. int rh = atoi(text + ++i);
  68.  
  69. - drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
  70. + drw_rect(drw, rx + x, ry + borderpx + vertpadbar / 2, rw, rh, 1, 0);
  71. } else if (text[i] == 'f') {
  72. x += atoi(text + ++i);
  73. }
  74. @@ -924,7 +924,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
  75.  
  76. if (!isCode) {
  77. w = TEXTW(text) - lrpad;
  78. - drw_text(drw, x, 0, w, bh, 0, text, 0);
  79. + drw_text(drw, x, borderpx + vertpadbar / 2, w, bh - vertpadbar, 0, text, 0);
  80. }
  81.  
  82. drw_setscheme(drw, scheme[SchemeNorm]);
  83. @@ -1234,17 +1234,22 @@ dragmfact(const Arg *arg)
  84. void
  85. drawbar(Monitor *m)
  86. {
  87. - int x, w, sw = 0, stw = 0;
  88. + int x, y = borderpx, w, sw = 0, stw = 0;
  89. + int th = bh - borderpx * 2;
  90. + int mw = m->ww - borderpx * 2;
  91. int boxs = drw->fonts->h / 9;
  92. int boxw = drw->fonts->h / 6 + 2;
  93. unsigned int i, occ = 0, urg = 0;
  94. Client *c;
  95.  
  96. + XSetForeground(drw->dpy, drw->gc, clrborder.pixel);
  97. + XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww, bh);
  98. +
  99. if(showsystray && m == systraytomon(m))
  100.  
  101. /* draw status first so it can be overdrawn by tags later */
  102. if (m == selmon) { /* status is only drawn on selected monitor */
  103. - sw = m->ww - drawstatusbar(m, bh, stext);
  104. + sw = mw - drawstatusbar(m, th, stext);
  105. }
  106.  
  107. resizebarwin(m);
  108. @@ -1253,31 +1258,31 @@ drawbar(Monitor *m)
  109. if (c->isurgent)
  110. urg |= c->tags;
  111. }
  112. - x = 0;
  113. + x = borderpx;
  114. for (i = 0; i < LENGTH(tags); i++) {
  115. w = TEXTW(tags[i]);
  116. drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
  117. - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
  118. + drw_text(drw, x, y, w, th, lrpad / 2, tags[i], urg & 1 << i);
  119. if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
  120. - drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
  121. + drw_rect(drw, x + ulinepad, th - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
  122. if (occ & 1 << i)
  123. - drw_rect(drw, x + boxs, boxs, boxw, boxw,
  124. + drw_rect(drw, x + boxs, y+ boxs, boxw, boxw,
  125. m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
  126. urg & 1 << i);
  127. x += w;
  128. }
  129. w = blw = TEXTW(m->ltsymbol);
  130. drw_setscheme(drw, scheme[SchemeNorm]);
  131. - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
  132. + x = drw_text(drw, x, y, w, th, lrpad / 2, m->ltsymbol, 0);
  133.  
  134. - if ((w = m->ww - sw - stw - x) > bh) {
  135. + if ((w = mw - sw - stw - x) > th) {
  136. if (m->sel) {
  137. drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
  138. if (m->sel->isfloating)
  139. - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
  140. + drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0);
  141. } else {
  142. drw_setscheme(drw, scheme[SchemeNorm]);
  143. - drw_rect(drw, x, 0, w, bh, 1, 1);
  144. + drw_rect(drw, x, y, w, th, 1, 1);
  145. }
  146. }
  147. drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
  148. @@ -2246,7 +2251,7 @@ setup(void)
  149. if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
  150. die("no fonts could be loaded.");
  151. lrpad = drw->fonts->h;
  152. - bh = user_bh ? user_bh : drw->fonts->h + 2;
  153. + bh = user_bh ? user_bh : drw->fonts->h + 2 + vertpadbar + borderpx * 2;
  154. updategeom();
  155. /* init atoms */
  156. utf8string = XInternAtom(dpy, "UTF8_STRING", False);
  157. @@ -2281,6 +2286,7 @@ setup(void)
  158. scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3);
  159. for (i = 0; i < LENGTH(colors); i++)
  160. scheme[i] = drw_scm_create(drw, colors[i], 3);
  161. + drw_clr_create(drw, &clrborder, col_borderbar);
  162. /* init system tray */
  163. updatesystray();
  164. /* init bars */
  165.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement