commit 1975317cd073ab5fa02d8639bbc6e8333e785bff
parent 88f2684695eaf63f449582c8d699e63deb02f729
Author: elbachir-one <bachiralfa@gmail.com>
Date: Mon, 6 Oct 2025 17:22:10 +0100
[dwm][patches][dualstatus]
- Fixed index.md
- Fixed patch — no more errors when applying it
Diffstat:
2 files changed, 177 insertions(+), 5 deletions(-)
diff --git a/dwm.suckless.org/patches/dualstatus/dwm-dualstatus-20251003-89e0350.diff b/dwm.suckless.org/patches/dualstatus/dwm-dualstatus-20251003-89e0350.diff
@@ -0,0 +1,169 @@
+From 89e03501c62b7533d7c4399e2b65feaaf8ccf1b0 Mon Sep 17 00:00:00 2001
+From: elbachir-one <bachiralfa@gmail.com>
+Date: Fri, 3 Oct 2025 10:39:34 +0100
+Subject: [PATCH] Fixed patch — no more errors when applying it
+
+---
+ config.def.h | 2 ++
+ dwm.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 55 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 3836510..d1bf68c 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
++static const int extrabar = 1; /* 0 means no extra bar */
+ static const char *fonts[] = { "monospace:size=10" };
+ static const char dmenufont[] = "monospace:size=10";
+ static const char col_gray1[] = "#222222";
+@@ -66,6 +67,7 @@ static const Key keys[] = {
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
++ { MODKEY, XK_b, toggleextrabar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+diff --git a/dwm.c b/dwm.c
+index 4f345ee..52149ad 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -140,6 +140,13 @@ typedef struct {
+ int monitor;
+ } Rule;
+
++typedef struct {
++ int y;
++ int show;
++ Window win;
++ char text[256];
++} Bar;
++
+ /* function declarations */
+ static void applyrules(Client *c);
+ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
+@@ -209,6 +216,7 @@ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglebar(const Arg *arg);
++static void toggleextrabar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+@@ -266,6 +274,7 @@ static Display *dpy;
+ static Drw *drw;
+ static Monitor *mons, *selmon;
+ static Window root, wmcheckwin;
++static Bar eb;
+
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+@@ -481,6 +490,8 @@ cleanup(void)
+ while (m->stack)
+ unmanage(m->stack, 0);
+ XUngrabKey(dpy, AnyKey, AnyModifier, root);
++ XUnmapWindow(dpy, eb.win);
++ XDestroyWindow(dpy, eb.win);
+ while (mons)
+ cleanupmon(mons);
+ for (i = 0; i < CurLast; i++)
+@@ -570,6 +581,7 @@ configurenotify(XEvent *e)
+ if (c->isfullscreen)
+ resizeclient(c, m->mx, m->my, m->mw, m->mh);
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
++ XMoveResizeWindow(dpy, eb.win, mons->wx, eb.y, mons->ww, bh);
+ }
+ focus(NULL);
+ arrange(NULL);
+@@ -745,6 +757,9 @@ drawbar(Monitor *m)
+ }
+ }
+ drw_map(drw, m->barwin, 0, 0, m->ww, bh);
++ drw_setscheme(drw, scheme[SchemeNorm]);
++ drw_text(drw, 0, 0, mons->ww, bh, 0, eb.text, 0);
++ drw_map(drw, eb.win, 0, 0, mons->ww, bh);
+ }
+
+ void
+@@ -1558,6 +1573,7 @@ setup(void)
+ sh = DisplayHeight(dpy, screen);
+ root = RootWindow(dpy, screen);
+ drw = drw_create(dpy, screen, root, sw, sh);
++ eb.show = extrabar;
+ if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
+ die("no fonts could be loaded.");
+ lrpad = drw->fonts->h;
+@@ -1720,6 +1736,17 @@ togglebar(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++toggleextrabar(const Arg *arg)
++{
++ if(selmon == mons) {
++ eb.show = !eb.show;
++ updatebarpos(selmon);
++ XMoveResizeWindow(dpy, eb.win, selmon->wx, eb.y, selmon->ww, bh);
++ arrange(selmon);
++ }
++}
++
+ void
+ togglefloating(const Arg *arg)
+ {
+@@ -1834,6 +1861,13 @@ updatebars(void)
+ XMapRaised(dpy, m->barwin);
+ XSetClassHint(dpy, m->barwin, &ch);
+ }
++ if (!eb.win) {
++ eb.win = XCreateWindow(dpy, root, mons->wx, eb.y, mons->ww, bh, 0, DefaultDepth(dpy, screen),
++ CopyFromParent, DefaultVisual(dpy, screen),
++ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
++ XDefineCursor(dpy, eb.win, cursor[CurNormal]->cursor);
++ XMapRaised(dpy, eb.win);
++ }
+ }
+
+ void
+@@ -1847,6 +1881,13 @@ updatebarpos(Monitor *m)
+ m->wy = m->topbar ? m->wy + bh : m->wy;
+ } else
+ m->by = -bh;
++
++ if (m == mons && eb.show) {
++ m->wh -= bh;
++ eb.y = topbar ? m->wy + m->wh : m->wy;
++ m->wy = m->topbar ? m->wy : m->wy + bh;
++ } else
++ eb.y = -bh;
+ }
+
+ void
+@@ -2004,8 +2045,19 @@ updatesizehints(Client *c)
+ void
+ updatestatus(void)
+ {
+- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
++ char text[512];
++ if (!gettextprop(root, XA_WM_NAME, text, sizeof(text))) {
+ strcpy(stext, "dwm-"VERSION);
++ eb.text[0] = '\0';
++ } else {
++ char *e = strchr(text, ';');
++ if (e) {
++ *e = '\0'; e++;
++ strncpy(eb.text, e, sizeof(eb.text)-1);
++ } else
++ eb.text[0] = '\0';
++ strncpy(stext, text, sizeof(stext)-1);
++ }
+ drawbar(selmon);
+ }
+
+--
+2.50.1
+
diff --git a/dwm.suckless.org/patches/dualstatus/index.md b/dwm.suckless.org/patches/dualstatus/index.md
@@ -3,24 +3,27 @@ dualstatus
Description
-----------
-This patch will enable an extra status bar in dwm. The extra bar can be toggled
-along with the standard bar or independently.
+This patch enables an additional status bar in DWM.
+The extra bar can be toggled together with the standard bar or independently.
-The status bar text can be set as follows:
+You can set the status bar text as follows:
xsetroot -name "top text;bottom text"
Download
--------
+* [dwm-dualstatus-20251003-89e0350.diff](dwm-dualstatus-20251003-89e0350.diff) (20251003)
* [dwm-dualstatus-6.1.diff](dwm-dualstatus-6.1.diff) (4683b) (20151110)
* [dwm-dualstatus-6.0.diff](dwm-dualstatus-6.0.diff) (4794b) (20130908)
Screenshot
----------
-a simple dual status bar
+A simple dual status bar

Authors
-------
-* Andrew Milkovich - `<amilkovich at gmail dot com>`
+* Andrew Milkovich - <amilkovich@gmail.com>
+* Nahyan Siddiqui - <nahyanl63@gmail.com>
+* EL Bachir - <bachiralfa@gmail.com>