Skip to content

Instantly share code, notes, and snippets.

@bpsuntrup
Created January 16, 2024 19:11
Show Gist options
  • Save bpsuntrup/fba85a1f1678167a3449d8ff9d845d5f to your computer and use it in GitHub Desktop.
Save bpsuntrup/fba85a1f1678167a3449d8ff9d845d5f to your computer and use it in GitHub Desktop.
dwm "cards" layout
void
cards(Monitor *mon) {
unsigned int i, n, nw, nh;
Client *c;
for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++);
if(n == 0)
return;
nw = mon->ww;
nh = mon->wh;
unsigned int gap = mon->gap->gappx * 2; /* quirky default, makes this change dependent on gaps */
for(i = 1, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
resize(c,
((n-i) * (gap + c->bw)) + mon->gap->gappx,
((n-i) * (gap + c->bw)) + mon->wy + mon->gap->gappx,
nw - (n * (gap + c->bw)),
nh - (n * (gap + c->bw)),
0
);
i++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment