DWM doesn’t have a way to minimize windows, which is good; we’re already using the tag system to decide which windows should be currently visible and which shouldn’t. And while I have a lot of tags and I like to sometimes combine or toggle them separately rather than always use them as “workspaces”, there are so many windows that at least one of the tags becomes sort of a junk pile. The “heap” as I like to label it and I have it as my fifth tag. A.k.a. tagmask 16
.
Here is a function for moving every visible but unselected window to the fifth tag:
void
heapunsel(const Arg *arg) {
if (!selmon->clients)
return;
int j;
Client* c;
for(c = selmon->clients; c; c = c->next)
{
if(ISVISIBLE(c) && c != selmon->sel)
for(j = 0; j < LENGTH(tags); j++)
{
if(c->tags & 1 << j && selmon->tagset[selmon->seltags] & 1 << j)
{
c->tags = c->tags ^ (1 << j & TAGMASK);
c->tags = c->tags | 16;
}
}
}
arrange(selmon);
}
I have it mapped to mod4+shift+m, it’s kind of similar to “monocle”
which I have set to mod4+m. So I can either quickly pop into monocle
to do something focused and then back to whatever layout I had, or I
can more permanently send all of the other windows to the “heap” over
on tag 5. (If you want to use this but want another tag than the fifth
to be your “junk heap”, then change the 16
to whatever tagmask you
want.)
I can easily bring something back to the heap when I’m there because I have
void
tagthenview(const Arg *arg) {
tag(arg);
view(arg);
}
also in my config.h
. (I’ve had that one for ages; I know that the more “official” viewontag patch exists now but I only sometimes want to follow the tag. I’m just as likely to tag a window to get it out of my face as I am to follow along with it. I have it set so that if I hold shift, I follow.
I don’t use the full pertag patch (maybe I should give that a try) but as a hack I have it set so that whenever the “heap” is visible it’s in gridmode, which requires the gridmode patch and changing arrangemon
to
void
arrangemon(Monitor *m)
{
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->tagset[m->seltags] & 16) // if fifth tag (tagmask 16) is visible,
grid(m); // then grid, else arrange.
else
if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m);
}
For any other layout, call its arrange function directly just like I
am calling grid(m)
here. I don’t use the grid layout for anything
else, I don’t even have it mapped to a key, I only use it here. I
don’t like fiddling too much with “the perfect layout”, I have
nmaster
unmapped too (although I used to use that at work where I
had a bigger screen). In addition to having some fantastic tiled
layouts, DWM is one of the best floating window managers I’ve ever
used, so I don’t mind sticking to just a few fave layouts and then
using floating windows.