summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-05-17 13:00:25 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-05-17 13:00:25 +0900
commita88492f385375e5cadb1433226d72f96e0ae08ee (patch)
tree6d706dcf05a498ae83b258ea4adbbae3bb089663
parent3b09d7bdfd7a1d0e7f90b34bcf605f1de18846e9 (diff)
modified dwm/config.def.h, modified dwm/dwm.c, created patches/dwm-mainmon-20220330-bece862.diff
-rw-r--r--dwm/config.def.h1
-rw-r--r--dwm/dwm.c2
-rw-r--r--dwm/patches/dwm-mainmon-20220330-bece862.diff47
3 files changed, 49 insertions, 1 deletions
diff --git a/dwm/config.def.h b/dwm/config.def.h
index 21fadcf..d639fde 100644
--- a/dwm/config.def.h
+++ b/dwm/config.def.h
@@ -15,6 +15,7 @@ static const double activeopacity = 1.0f; /* Window opacity when it's
static const double inactiveopacity = 1.0f; /* Window opacity when it's inactive (0 <= opacity <= 1) */
static const int allowkill = 1; /* allow killing clients by default? */
static int alt_tab_direction = 1; /* 1 means cycle forward */
+static const int mainmon = 0; /* xsetroot will only change the bar on this monitor */
static int showbar = 1; /* 0 means no bar */
static const int showfloating = 1; /* 0 means no floating indicator */
static const int showlayout = 1; /* 0 means no layout indicator */
diff --git a/dwm/dwm.c b/dwm/dwm.c
index d487d44..ba67d41 100644
--- a/dwm/dwm.c
+++ b/dwm/dwm.c
@@ -1131,7 +1131,7 @@ drawbar(Monitor *m)
return;
/* draw status first so it can be overdrawn by tags later */
- if ((m == selmon && selmon->showstatus) || (statusall && selmon->showstatus)) { /* status is only drawn on selected monitor */
+ if ((m == &mons[mainmon] && selmon->showstatus) || (statusall && selmon->showstatus)) { /* status is only drawn on selected monitor */
char *text, *s, ch;
if (m == selmon)
drw_setscheme(drw, scheme[SchemeStatusSel]);
diff --git a/dwm/patches/dwm-mainmon-20220330-bece862.diff b/dwm/patches/dwm-mainmon-20220330-bece862.diff
new file mode 100644
index 0000000..8f34b58
--- /dev/null
+++ b/dwm/patches/dwm-mainmon-20220330-bece862.diff
@@ -0,0 +1,47 @@
+From 9cd7e774ec9f2289d5310e9a6a95171126636a14 Mon Sep 17 00:00:00 2001
+From: Benjamin Chausse <benjamin@chausse.xyz>
+Date: Wed, 30 Mar 2022 23:32:01 -0400
+Subject: [PATCH] Mainmon - Main monitor for the statusbar
+
+This small patch add a mainmon value to the config.def.h.
+It let's the user choose a monitor on which to have the
+statusbar show-up. The status will no longer follow which
+monitor is currently selected.
+
+It is especially usefull in two scenarios:
+- A monitor is setup vertically and has little room for the status.
+- Dwm is used in a public environment and it's user does not want
+ the contents of the status bar to be shown (i.e. on a projector).
+---
+ config.def.h | 1 +
+ dwm.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index a2ac963..c229c10 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -36,6 +36,7 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
+ static const int nmaster = 1; /* number of clients in master area */
+ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
++static const int mainmon = 0; /* xsetroot will only change the bar on this monitor */
+
+ static const Layout layouts[] = {
+ /* symbol arrange function */
+diff --git a/dwm.c b/dwm.c
+index 5f16260..9cf08fb 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -707,7 +707,7 @@ drawbar(Monitor *m)
+ return;
+
+ /* draw status first so it can be overdrawn by tags later */
+- if (m == selmon) { /* status is only drawn on selected monitor */
++ if (m == &mons[mainmon]) { /* status is only drawn on main 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);
+--
+2.35.1
+