add gaps in monocle

This commit is contained in:
Ray Andrew 2024-10-13 11:58:21 -05:00
parent da55d1ecf3
commit 01ef7f2524
2 changed files with 19 additions and 3 deletions

View file

@ -76,10 +76,10 @@ static const Rule rules[] = {
*/
/* class instance title tags mask iscentered isfloating isterminal noswallow monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 },
{ "st", NULL, "thesaurus-syn", 0, 1, 1, 1, 1, -1 },
{ "wezterm", NULL, NULL, 0, 0, 0, 1, 0, -1 },
{ "st", NULL, NULL, 0, 0, 0, 1, 0, -1 },
{ "Gcr-prompter", NULL, NULL, 0, 1, 1, 1, 0, -1 },
{ "st", NULL, "thesaurus-syn", 0, 1, 1, 1, 1, -1 },
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
};
@ -231,13 +231,17 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_o, spawn, SHCMD("/usr/bin/maim -s | /usr/bin/xclip -selection clipboard -t image/png") },
{ 0, XK_Print, spawn, SHCMD("/usr/bin/maim -s ~/Screenshots/$(date +%Y-%m-%d-%H-%M-%S).png") },
// thesaurus
{ MODKEY|ShiftMask, XK_t, spawn, SHCMD("~/bin/thesaurus-rofi") },
{ MODKEY|ControlMask, XK_t, spawn, SHCMD("~/bin/thesaurus-rofi-syn") },
// others
{ MODKEY, XK_m, spawn, TERM("neomutt") },
{ MODKEY, XK_b, spawn, TERM("yazi") },
{ MODKEY, XK_semicolon, spawn, TERM("btop") },
{ 0, XK_F12, spawn, SHCMD("~/bin/dwm-man") },
// { MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("dinitctl restart wm") },
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD("killall dinit") },

14
dwm.c
View file

@ -1668,6 +1668,17 @@ monocle(Monitor *m)
{
unsigned int n = 0;
Client *c;
int nx, ny, nw, nh;
int oh, ov, ih, iv;
getgaps(m, &oh, &ov, &ih, &iv, &n);
if (n == 0)
return;
nx = m->wx + ov;
ny = m->wy + oh;
nw = m->ww - 2*ov;
nh = m->wh - 2*oh;
for (c = m->clients; c; c = c->next)
if (ISVISIBLE(c))
@ -1675,7 +1686,8 @@ monocle(Monitor *m)
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, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
// resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, 0);
}
void