You are not logged in.
I'm trying to add the init layout to dwm 6.1 (Xft).
I'm going according to the pertag patch here:
http://dwm.suckless.org/patches/dwm-6.1-pertag.diff
I would like the tags to initialize with a predefined layout {0, 1, 2}.
I don't know if this feature is already built-in into this new pertag patch but the main function involved here is:
Monitor *
createmon(void) {
Monitor *m;
int i;
if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
if(!(m->pertag = (Pertag *)calloc(1, sizeof(Pertag))))
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;
/* init mfacts */
m->pertag->mfacts[i] = m->mfact;
/* init layouts */
m->pertag->ltidxs[i][0] = m->lt[0];
m->pertag->ltidxs[i][1] = m->lt[1];
m->pertag->sellts[i] = m->sellt;
/* init showbar */
m->pertag->showbars[i] = m->showbar;
/* swap focus and zoomswap*/
m->pertag->prevzooms[i] = NULL;
}
return m;
}There is no documentation or it's nto very clear to me. Can I initialize ltidxs with a predefined matrix in config.h?
Last edited by wildfowl (2015-05-29 10:30:58)
Offline
Define a new static vector/array variable say as follows:
static const int initlayouts[] = { 0, 2, 0, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0 }; Replace the two init layout assignments in the for loop in the function createmon with:
m->pertag->ltidxs[i][0] = &layouts[initlayouts[i-1]];
m->pertag->ltidxs[i][1] = m->lt[1];Initially it was not obvious to me that ltidxs is a N x 2 array where the first column of the matrix carries the actual layout {0, 1, 2} and crucially that the second column carries just the symbol.
It's a simple hack with the minimum of fuss and so I am happy with it.
Offline