[wiki] [sites] [dwm] Adding a patch staticstatus that keeps your status bar in one place when you use a multi-monitor setup, no matter where your focus is. || iressa

From: <git_AT_suckless.org>
Date: Sun, 07 Jun 2020 16:32:17 +0200

commit 6818a7fad74cb2534c0b93f13d0c9e5774f8ff2d
Author: iressa <iressa_AT_bgsu.edu>
Date: Sun Jun 7 10:30:53 2020 -0400

    [dwm] Adding a patch staticstatus that keeps your status bar in one place when you use a multi-monitor setup, no matter where your focus is.

diff --git a/dwm.suckless.org/patches/staticstatus/dwm-staticstatus-6.2.diff b/dwm.suckless.org/patches/staticstatus/dwm-staticstatus-6.2.diff
new file mode 100644
index 00000000..17cb9057
--- /dev/null
+++ b/dwm.suckless.org/patches/staticstatus/dwm-staticstatus-6.2.diff
_AT_@ -0,0 +1,60 @@
+diff --git a/dwm.c b/dwm.c
+index 9fd0286..d6eb701 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -266,7 +266,7 @@ static Cur *cursor[CurLast];
+ static Clr **scheme;
+ static Display *dpy;
+ static Drw *drw;
+-static Monitor *mons, *selmon;
++static Monitor *mons, *selmon, *statmon;
+ static Window root, wmcheckwin;
+
+ /* configuration, allows nested code to access above variables */
+_AT_@ -703,7 +703,7 @@ drawbar(Monitor *m)
+ Client *c;
+
+ /* draw status first so it can be overdrawn by tags later */
+- if (m == selmon) { /* status is only drawn on selected monitor */
++ if (m == statmon) { /* status is only drawn on user-defined status monitor */
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
+ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+_AT_@ -1879,7 +1879,7 @@ updategeom(void)
+ else
+ mons = createmon();
+ }
+- for (i = 0, m = mons; i < nn && m; m = m->next, i++)
++ for (i = 0, m = mons; i < nn && m; m = m->next, i++){
+ if (i >= n
+ || unique[i].x_org != m->mx || unique[i].y_org != m->my
+ || unique[i].width != m->mw || unique[i].height != m->mh)
+_AT_@ -1892,6 +1892,10 @@ updategeom(void)
+ m->mh = m->wh = unique[i].height;
+ updatebarpos(m);
+ }
++ if(i == statmonval)
++ statmon = m;
++ }
++
+ } else { /* less monitors available nn < n */
+ for (i = nn; i < n; i++) {
+ for (m = mons; m && m->next; m = m->next);
+_AT_@ -1905,6 +1909,8 @@ updategeom(void)
+ }
+ if (m == selmon)
+ selmon = mons;
++ if (m == statmon)
++ statmon = mons;
+ cleanupmon(m);
+ }
+ }
+_AT_@ -1992,7 +1998,7 @@ updatestatus(void)
+ {
+ if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
+ strcpy(stext, "dwm-"VERSION);
+- drawbar(selmon);
++ drawbar(statmon);
+ }
+
+ void
diff --git a/dwm.suckless.org/patches/staticstatus/index.md b/dwm.suckless.org/patches/staticstatus/index.md
new file mode 100644
index 00000000..0933d7be
--- /dev/null
+++ b/dwm.suckless.org/patches/staticstatus/index.md
_AT_@ -0,0 +1,19 @@
+staticstatus
+=====
+
+Description
+-----------
+This patch forces your status bar to stay put on a single monitor in a multi-monitor setup, no matter where your focus is. You can set which monitor you want the status bar to stay in with the statmonval value (in config.h), whose values are from 0 to (the number of monitors you have)-1. Monitors are enumerated in the order that they're picked up by dwm. Make sure to define the value in your config.h before compiling.
+
+Configuration
+-------------
+
+ static const int statmonval = 0;
+
+Download
+--------
+* [dwm-staticstatus-6.2.diff](dwm-staticstatus-6.2.diff)
+
+Author
+------
+* Ian Ressa <ianprb_AT_posteo.us>
Received on Sun Jun 07 2020 - 16:32:17 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 07 2020 - 16:36:45 CEST