make smfact compatible with pertag

This commit is contained in:
Jakub 2024-05-15 16:23:06 -04:00
parent c88efa050f
commit 7ffccdd3c9

13
dwm.c
View File

@ -334,6 +334,7 @@ struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */ unsigned int curtag, prevtag; /* current and previous tag */
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
float smfacts[LENGTH(tags) + 1]; /* smfacts per tag */
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
@ -799,6 +800,7 @@ createmon(void)
for (i = 0; i <= LENGTH(tags); i++) { for (i = 0; i <= LENGTH(tags); i++) {
m->pertag->nmasters[i] = m->nmaster; m->pertag->nmasters[i] = m->nmaster;
m->pertag->mfacts[i] = m->mfact; m->pertag->mfacts[i] = m->mfact;
m->pertag->smfacts[i] = m->smfact;
m->pertag->ltidxs[i][0] = m->lt[0]; m->pertag->ltidxs[i][0] = m->lt[0];
m->pertag->ltidxs[i][1] = m->lt[1]; m->pertag->ltidxs[i][1] = m->lt[1];
@ -1959,6 +1961,7 @@ setmfact(const Arg *arg)
void void
setsmfact(const Arg *arg) { setsmfact(const Arg *arg) {
float sf; float sf;
unsigned int i;
if(!arg || !selmon->lt[selmon->sellt]->arrange) if(!arg || !selmon->lt[selmon->sellt]->arrange)
return; return;
@ -1966,6 +1969,14 @@ setsmfact(const Arg *arg) {
if(sf < 0 || sf > 0.9) if(sf < 0 || sf > 0.9)
return; return;
selmon->smfact = sf; selmon->smfact = sf;
for(i=0; i<LENGTH(tags); ++i)
if(selmon->tagset[selmon->seltags] & 1<<i)
selmon->pertag->smfacts[i+1] = sf;
if(selmon->pertag->curtag == 0)
{
selmon->pertag->smfacts[0] = sf;
}
arrange(selmon); arrange(selmon);
} }
@ -2332,6 +2343,7 @@ toggleview(const Arg *arg)
/* apply settings for this view */ /* apply settings for this view */
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[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->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; 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]; 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->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[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->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; 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]; selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];