summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-04-26 16:26:36 +0200
committerbakkeby <[email protected]>2020-04-26 16:29:44 +0200
commit14b7edd911c877e73fb76974581cef68b0ea9e73 (patch)
treeddfef1825b82bd86458ac99e8ab4cf5dacb22340
parent5848460fffcecd7306e9c71b1e4e6c7c1e6c072c (diff)
downloaddwm-flexipatch-14b7edd911c877e73fb76974581cef68b0ea9e73.tar.gz
dwm-flexipatch-14b7edd911c877e73fb76974581cef68b0ea9e73.zip
Expanded monitor rules patch to include nmaster, showbar and topbar options.
-rw-r--r--README.md4
-rw-r--r--config.def.h12
-rw-r--r--dwm.c46
3 files changed, 40 insertions, 22 deletions
diff --git a/README.md b/README.md
index 14c13e9..bfee118 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-04-26 - Expanded monitor rules patch to include nmaster, showbar and topbar options
+
2020-04-23 - Improved swallow and switchtag compatibility
2020-04-16 - Upgraded the scratchpad patch to the multiple scratchpads patch \[[ref](https://lists.suckless.org/hackers/2004/17205.html)\]. Updated the statuscolors patch with the width computation fix \[[ref](https://lists.suckless.org/hackers/2004/17207.html)\].
@@ -251,7 +253,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [mdpcontrol](https://dwm.suckless.org/patches/mpdcontrol/)
- adds keyboard bindings to control MDP (Music Player Daemon)
- - monitorrules
+ - [monitorrules](https://github.com/bakkeby/patches/blob/master/dwm/dwm-monitorrules-6.2.diff)
- adds rules per monitor, e.g. have default layouts per monitor
- the use case for this is if the second monitor is vertical (i.e. rotated) then you may want to use a different default layout for this monitor than what is used for the main monitor (for example normal vertical split for main monitor and horizontal split for the second)
diff --git a/config.def.h b/config.def.h
index a164d5b..150dbee 100644
--- a/config.def.h
+++ b/config.def.h
@@ -441,15 +441,15 @@ static const Rule rules[] = {
#if MONITOR_RULES_PATCH
#if PERTAG_PATCH
static const MonitorRule monrules[] = {
- /* monitor tag layout mfact */
- { 1, -1, 2, -1 }, // use a different layout for the second monitor
- { -1, -1, 0, -1 }, // default
+ /* monitor tag layout mfact nmaster showbar topbar */
+ { 1, -1, 2, -1, -1, -1, -1 }, // use a different layout for the second monitor
+ { -1, -1, 0, -1, -1, -1, -1 }, // default
};
#else
static const MonitorRule monrules[] = {
- /* monitor layout mfact */
- { 1, 2, -1 }, // use a different layout for the second monitor
- { -1, 0, -1 }, // default
+ /* monitor layout mfact nmaster showbar topbar */
+ { 1, 2, -1, -1, -1, -1 }, // use a different layout for the second monitor
+ { -1, 0, -1, -1, -1, -1 }, // default
};
#endif // PERTAG_PATCH
#endif // MONITOR_RULES_PATCH
diff --git a/dwm.c b/dwm.c
index b982a3f..8f9ab9e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -317,6 +317,9 @@ typedef struct {
#endif // PERTAG_PATCH
int layout;
float mfact;
+ int nmaster;
+ int showbar;
+ int topbar;
} MonitorRule;
#endif // MONITOR_RULES_PATCH
@@ -1280,6 +1283,15 @@ createmon(void)
m->lt[0] = &layouts[mr->layout];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[mr->layout].symbol, sizeof m->ltsymbol);
+
+ if (mr->mfact > -1)
+ m->mfact = mr->mfact;
+ if (mr->nmaster > -1)
+ m->nmaster = mr->nmaster;
+ if (mr->showbar > -1)
+ m->showbar = mr->showbar;
+ if (mr->topbar > -1)
+ m->topbar = mr->topbar;
break;
}
}
@@ -1301,16 +1313,27 @@ createmon(void)
die("fatal: could not malloc() %u bytes\n", sizeof(Pertag));
m->pertag->curtag = m->pertag->prevtag = 1;
for (i = 0; i <= LENGTH(tags); i++) {
- /* init nmaster */
- m->pertag->nmasters[i] = m->nmaster;
-
#if FLEXTILE_DELUXE_LAYOUT
m->pertag->nstacks[i] = m->nstack;
#endif // FLEXTILE_DELUXE_LAYOUT
+ #if !MONITOR_RULES_PATCH
+ /* init nmaster */
+ m->pertag->nmasters[i] = m->nmaster;
+
/* init mfacts */
m->pertag->mfacts[i] = m->mfact;
+ #if PERTAGBAR_PATCH
+ /* init showbar */
+ m->pertag->showbars[i] = m->showbar;
+ #endif // PERTAGBAR_PATCH
+ #endif // MONITOR_RULES_PATCH
+
+ #if ZOOMSWAP_PATCH
+ m->pertag->prevzooms[i] = NULL;
+ #endif // ZOOMSWAP_PATCH
+
/* init layouts */
#if MONITOR_RULES_PATCH
for (j = 0; j < LENGTH(monrules); j++) {
@@ -1318,8 +1341,11 @@ createmon(void)
if ((mr->monitor == -1 || mr->monitor == mc) && (mr->tag == -1 || mr->tag == i)) {
m->pertag->ltidxs[i][0] = &layouts[mr->layout];
m->pertag->ltidxs[i][1] = m->lt[0];
- if (mr->mfact != -1)
- m->pertag->mfacts[i] = mr->mfact;
+ m->pertag->nmasters[i] = (mr->nmaster > -1 ? mr->nmaster : m->nmaster);
+ m->pertag->mfacts[i] = (mr->mfact > -1 ? mr->mfact : m->mfact);
+ #if PERTAGBAR_PATCH
+ m->pertag->showbars[i] = (mr->showbar > -1 ? mr->showbar : m->showbar);
+ #endif // PERTAGBAR_PATCH
#if FLEXTILE_DELUXE_LAYOUT
m->pertag->ltaxis[i][LAYOUT] = m->pertag->ltidxs[i][0]->preset.layout;
m->pertag->ltaxis[i][MASTER] = m->pertag->ltidxs[i][0]->preset.masteraxis;
@@ -1342,16 +1368,6 @@ createmon(void)
#endif // MONITOR_RULES_PATCH
m->pertag->sellts[i] = m->sellt;
- #if PERTAGBAR_PATCH
- /* init showbar */
- m->pertag->showbars[i] = m->showbar;
-
- /* swap focus and zoomswap*/
- #if ZOOMSWAP_PATCH
- m->pertag->prevzooms[i] = NULL;
- #endif // ZOOMSWAP_PATCH
- #endif // PERTAGBAR_PATCH
-
#if VANITYGAPS_PATCH
m->pertag->enablegaps[i] = 1;
#endif // VANITYGAPS_PATCH