dwm-mainmon-20220330-bece862.diff (1883B)
1 From 9cd7e774ec9f2289d5310e9a6a95171126636a14 Mon Sep 17 00:00:00 2001 2 From: Benjamin Chausse <benjamin@chausse.xyz> 3 Date: Wed, 30 Mar 2022 23:32:01 -0400 4 Subject: [PATCH] Mainmon - Main monitor for the statusbar 5 6 This small patch add a mainmon value to the config.def.h. 7 It let's the user choose a monitor on which to have the 8 statusbar show-up. The status will no longer follow which 9 monitor is currently selected. 10 11 It is especially usefull in two scenarios: 12 - A monitor is setup vertically and has little room for the status. 13 - Dwm is used in a public environment and it's user does not want 14 the contents of the status bar to be shown (i.e. on a projector). 15 --- 16 config.def.h | 1 + 17 dwm.c | 2 +- 18 2 files changed, 2 insertions(+), 1 deletion(-) 19 20 diff --git a/config.def.h b/config.def.h 21 index a2ac963..c229c10 100644 22 --- a/config.def.h 23 +++ b/config.def.h 24 @@ -36,6 +36,7 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] 25 static const int nmaster = 1; /* number of clients in master area */ 26 static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ 27 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ 28 +static const int mainmon = 0; /* xsetroot will only change the bar on this monitor */ 29 30 static const Layout layouts[] = { 31 /* symbol arrange function */ 32 diff --git a/dwm.c b/dwm.c 33 index 5f16260..9cf08fb 100644 34 --- a/dwm.c 35 +++ b/dwm.c 36 @@ -707,7 +707,7 @@ drawbar(Monitor *m) 37 return; 38 39 /* draw status first so it can be overdrawn by tags later */ 40 - if (m == selmon) { /* status is only drawn on selected monitor */ 41 + if (m == &mons[mainmon]) { /* status is only drawn on main monitor */ 42 drw_setscheme(drw, scheme[SchemeNorm]); 43 tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 44 drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); 45 -- 46 2.35.1 47