From 7ffccdd3c9c077c3447f240eb6eead500affdc09 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 15 May 2024 16:23:06 -0400 Subject: [PATCH] make smfact compatible with pertag --- dwm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dwm.c b/dwm.c index cfd5a85..cbdb771 100644 --- a/dwm.c +++ b/dwm.c @@ -334,6 +334,7 @@ struct Pertag { unsigned int curtag, prevtag; /* current and previous tag */ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ + float smfacts[LENGTH(tags) + 1]; /* smfacts per tag */ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ @@ -799,6 +800,7 @@ createmon(void) for (i = 0; i <= LENGTH(tags); i++) { m->pertag->nmasters[i] = m->nmaster; m->pertag->mfacts[i] = m->mfact; + m->pertag->smfacts[i] = m->smfact; m->pertag->ltidxs[i][0] = m->lt[0]; m->pertag->ltidxs[i][1] = m->lt[1]; @@ -1959,6 +1961,7 @@ setmfact(const Arg *arg) void setsmfact(const Arg *arg) { float sf; + unsigned int i; if(!arg || !selmon->lt[selmon->sellt]->arrange) return; @@ -1966,6 +1969,14 @@ setsmfact(const Arg *arg) { if(sf < 0 || sf > 0.9) return; selmon->smfact = sf; + for(i=0; itagset[selmon->seltags] & 1<pertag->smfacts[i+1] = sf; + + if(selmon->pertag->curtag == 0) + { + selmon->pertag->smfacts[0] = sf; + } arrange(selmon); } @@ -2332,6 +2343,7 @@ toggleview(const Arg *arg) /* apply settings for this view */ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; + selmon->smfact = selmon->pertag->smfacts[selmon->pertag->curtag]; selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; @@ -2729,6 +2741,7 @@ view(const Arg *arg) selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; + selmon->smfact = selmon->pertag->smfacts[selmon->pertag->curtag]; selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];