summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-07-05 21:53:36 +0200
committerbakkeby <[email protected]>2020-07-05 21:53:36 +0200
commitab488abc118f26fd999e1592a4d0f3ff997980ba (patch)
tree3cb20e55bbc21de6df73fa84c5ea24808d161c39
parent5478f99c3b9ee86a2714bfa17a098308f844e356 (diff)
downloaddwm-flexipatch-ab488abc118f26fd999e1592a4d0f3ff997980ba.tar.gz
dwm-flexipatch-ab488abc118f26fd999e1592a4d0f3ff997980ba.zip
Extrabar compatibility improvements
-rw-r--r--README.md2
-rw-r--r--dwm.c98
-rw-r--r--patch/statuscmd.c5
3 files changed, 89 insertions, 16 deletions
diff --git a/README.md b/README.md
index f433883..914cf73 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
+2020-07-05 - Extrabar compatibility improvements (staticstatus, statu2d, dwmblocks) and fix for systray randomly causing dwm to crash when first systray application starts
+
2020-06-24 - Added resizepoint, statusbutton and sendmon_keepfocus patches
2020-06-21 - Added floatpos and bar_height patches
diff --git a/dwm.c b/dwm.c
index bc7c35e..fd7ab08 100644
--- a/dwm.c
+++ b/dwm.c
@@ -291,7 +291,10 @@ struct Monitor {
int by; /* bar geometry */
int tw; /* bar text width */
#if EXTRABAR_PATCH
- int eby; /* extra bar geometry */
+ int eby; /* extra bar geometry */
+ #if STATUSCMD_PATCH
+ int etw; /* extra bar text width */
+ #endif // STATUSCMD_PATCH
#endif // EXTRABAR_PATCH
#if AWESOMEBAR_PATCH
int btw; /* width of tasks portion of bar */
@@ -520,13 +523,24 @@ static char stext[1024];
#else
static char stext[256];
#endif // STATUS2D_PATCH
+#if STATUS2D_PATCH
+static char rawstext[1024];
+#else
+static char rawstext[512];
+#endif // STATUS2D_PATCH
#if EXTRABAR_PATCH
#if STATUS2D_PATCH && !STATUSCOLORS_PATCH
static char estext[1024];
#else
static char estext[256];
#endif // STATUS2D_PATCH
+#if STATUSCMD_PATCH
+static char rawestext[1024];
+#else
+static char rawestext[512];
+#endif // STATUSCMD_PATCH
#endif // EXTRABAR_PATCH
+
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */
@@ -993,6 +1007,60 @@ buttonpress(XEvent *e)
#if LEFTLAYOUT_PATCH || STATUSBUTTON_PATCH
}
#endif // LEFTLAYOUT_PATCH | STATUSBUTTON_PATCH
+ #if EXTRABAR_PATCH && STATUSCMD_PATCH
+ } else if (ev->window == selmon->extrabarwin) {
+ i = x = 0;
+ padding = 0;
+ #if BARPADDING_PATCH
+ padding -= sp * 2;
+ #endif // BARPADDING_PATCH
+ if (ev->x > selmon->ww - selmon->etw + padding)
+ {
+ click = ClkStatusText;
+ xc = selmon->ww - selmon->etw + padding;
+ #if STATUSPADDING_PATCH
+ xc += lrpad / 2;
+ #endif // STATUSPADDING_PATCH
+ char *text = rawestext;
+ int i = -1;
+ char ch;
+ #if DWMBLOCKS_PATCH
+ dwmblockssig = -1;
+ #else
+ statuscmdn = 0;
+ #endif // DWMBLOCKS_PATCH
+ while (text[++i]) {
+ if ((unsigned char)text[i] < ' ') {
+ ch = text[i];
+ text[i] = '\0';
+ #if STATUS2D_PATCH && !STATUSCOLORS_PATCH
+ xc += status2dtextlength(text);
+ #elif PANGO_PATCH
+ xc += TEXTWM(text) - lrpad;
+ #else
+ xc += TEXTW(text) - lrpad;
+ #endif // STATUS2D_PATCH
+ text[i] = ch;
+ text += i+1;
+ i = -1;
+ #if DWMBLOCKS_PATCH
+ if (xc >= ev->x && dwmblockssig != -1)
+ break;
+ dwmblockssig = ch;
+ #else
+ if (xc >= ev->x)
+ break;
+ if (ch <= LENGTH(statuscmds))
+ statuscmdn = ch - 1;
+ #endif // DWMBLOCKS_PATCH
+ }
+ }
+ #if DWMBLOCKS_PATCH
+ if (dwmblockssig == -1)
+ dwmblockssig = 0;
+ #endif // DWMBLOCKS_PATCH
+ }
+ #endif // EXTRABAR_PATCH
} else if ((c = wintoclient(ev->window))) {
#if FOCUSONCLICK_PATCH
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
@@ -1926,12 +1994,20 @@ drawbar(Monitor *m)
if (m == selmon)
#endif // STATICSTATUS_PATCH
{ /* extra status is only drawn on selected monitor */
- #if STATUS2D_PATCH
+ #if STATUSCMD_PATCH && STATUS2D_PATCH
+ m->etw = m->ww - drawstatusbar(m, bh, estext, 0, 0);
+ #elif STATUS2D_PATCH
drawstatusbar(m, bh, estext, 0, 0);
#elif PANGO_PATCH
drw_text(drw, 0, 0, mons->ww, bh, 0, estext, 0, True);
+ #if STATUSCMD_PATCH
+ m->etw = TEXTWM(estext) - lrpad;
+ #endif // STATUSCMD_PATCH
#else
drw_text(drw, 0, 0, mons->ww, bh, 0, estext, 0);
+ #if STATUSCMD_PATCH
+ m->etw = TEXTW(estext) - lrpad;
+ #endif // STATUSCMD_PATCH
#endif // PANGO_PATCH
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
}
@@ -4180,26 +4256,26 @@ updatestatus(void)
Monitor* m;
#endif // STATUSALLMONS_PATCH
#if EXTRABAR_PATCH
- #if STATUS2D_PATCH
- char text[1024];
- #else
- char text[512];
- #endif // STATUS2D_PATCH
- if (!gettextprop(root, XA_WM_NAME, text, sizeof(text))) {
+ if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) {
strcpy(stext, "dwm-"VERSION);
estext[0] = '\0';
} else {
- char *e = strchr(text, statussep);
+ char *e = strchr(rawstext, statussep);
if (e) {
*e = '\0'; e++;
+ #if STATUSCMD_PATCH
+ strncpy(rawestext, e, sizeof(estext) - 1);
+ copyvalidchars(estext, rawestext);
+ #else
strncpy(estext, e, sizeof(estext) - 1);
+ #endif // STATUSCMD_PATCH
} else {
estext[0] = '\0';
}
#if STATUSCMD_PATCH
- copyvalidchars(stext, text);
+ copyvalidchars(stext, rawstext);
#else
- strncpy(stext, text, sizeof(stext) - 1);
+ strncpy(stext, rawstext, sizeof(stext) - 1);
#endif // STATUSCMD_PATCH
}
#elif STATUSCMD_PATCH
diff --git a/patch/statuscmd.c b/patch/statuscmd.c
index ddb0c87..b38739d 100644
--- a/patch/statuscmd.c
+++ b/patch/statuscmd.c
@@ -1,8 +1,3 @@
-#if STATUS2D_PATCH
-static char rawstext[1024];
-#else
-static char rawstext[256];
-#endif // STATUS2D_PATCH
#if !DWMBLOCKS_PATCH
static const char statusexport[] = "export BUTTON=-;";
static int statuscmdn;