bakkeby / patches

Collection of patches for dwm, st and dmenu
286 stars 30 forks source link

Outergaps with monocle mode #42

Closed paniash closed 2 years ago

paniash commented 2 years ago

Hi!

I'm currently using the vanitygaps patch and was wondering if it is possible to make monocle mode have outergaps (similar to tiling mode with just one window).

Thanks in advanced!

bakkeby commented 2 years ago

Yes you can. It is just not part of the patch as most people seem to prefer monocle without gaps.

You can replace the monocle function with this one:

void
monocle(Monitor *m)
{
    unsigned int n;
    int oh, ov, ih, iv;
    Client *c;

    getgaps(m, &oh, &ov, &ih, &iv, &n);

    if (n > 0) /* override layout symbol */
        snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);

    for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
        resize(c, m->wx + ov, m->wy + oh, m->ww - 2 * c->bw - 2 * ov, m->wh - 2 * c->bw - 2 * oh, 0);
}
paniash commented 2 years ago

@bakkeby Thanks a lot!

Although the following snippet was removed:

for (c = m->clients; c; c = c->next)
    if (ISVISIBLE(c))
        n++;

Could you tell me what is its purpose? I see that the number of clients gets mislabeled when the above snippet is present.

bakkeby commented 2 years ago

The only purpose of those lines is to count the number of visible clients, stored in the variable n.

This happens in the getgaps function hence it is no longer needed.

paniash commented 2 years ago

This happens in the getgaps function hence it is no longer needed.

Awesome! Thank you very much. :-)