Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config.def.h b/config.def.h
- index f50c13e..83c69f4 100644
- --- a/config.def.h
- +++ b/config.def.h
- @@ -11,6 +11,7 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display sy
- static const int showsystray = 1; /* 0 means no systray */
- static const int showbar = 1; /* 0 means no bar */
- static const int topbar = 1; /* 0 means bottom bar */
- +static const int gappx = 10;
- static const char *fonts[] = {"Cantarell-Regular:size=12", "Fira Code Nerd Font:size=12"};
- static int barheight;
- @@ -391,6 +392,10 @@ static Key keys[] = {
- { MODKEY, XK_o, winview, {0} },
- + { MODKEY, XK_minus, setgaps, {.i = -5 } },
- + { MODKEY, XK_equal, setgaps, {.i = +5 } },
- + { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
- +
- };
- /* button definitions */
- diff --git a/instantwm.c b/instantwm.c
- index f9b8d9f..751feb4 100644
- --- a/instantwm.c
- +++ b/instantwm.c
- @@ -1119,6 +1119,7 @@ createmon(void)
- m->nmaster = nmaster;
- m->showbar = showbar;
- m->topbar = topbar;
- + m->gappx = gappx;
- m->clientcount = 0;
- m->overlaymode = 0;
- m->scratchvisible = 0;
- @@ -3703,6 +3704,16 @@ setfullscreen(Client *c, int fullscreen)
- }
- }
- +void
- +setgaps(const Arg *arg)
- +{
- + if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
- + selmon->gappx = 0;
- + else
- + selmon->gappx += arg->i;
- + arrange(selmon);
- +}
- +
- void
- setlayout(const Arg *arg)
- {
- diff --git a/instantwm.h b/instantwm.h
- index de572d4..7cf6a96 100644
- --- a/instantwm.h
- +++ b/instantwm.h
- @@ -121,6 +121,7 @@ struct Monitor {
- int bt; /* number of tasks */
- int mx, my, mw, mh; /* screen size */
- int wx, wy, ww, wh; /* window area */
- + int gappx;
- unsigned int seltags;
- unsigned int sellt;
- unsigned int tagset[2];
- @@ -261,6 +262,7 @@ int getxtag(int ix);
- void setclientstate(Client *c, long state);
- void setfocus(Client *c);
- void setfullscreen(Client *c, int fullscreen);
- +static void setgaps(const Arg* arg);
- void setlayout(const Arg *arg);
- void setmfact(const Arg *arg);
- void setup(void);
- diff --git a/layouts.c b/layouts.c
- index 9925004..982ec46 100644
- --- a/layouts.c
- +++ b/layouts.c
- @@ -123,15 +123,15 @@ deck(Monitor *m)
- if(n > m->nmaster)
- mw = m->nmaster ? m->ww * m->mfact : 0;
- else
- - mw = m->ww;
- - for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- + mw = m->ww - m->gappx;
- + for(i = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- if(i < m->nmaster) {
- - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
- - my += HEIGHT(c);
- + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
- + resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), False);
- + my += HEIGHT(c) + m->gappx;
- }
- else
- - resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
- + resize(c, m->wx + mw + m->gappx, m->wy, m->ww - mw - (2*c->bw) - 2*m->gappx, m->wh - (2*c->bw), False);
- }
- void
- @@ -354,30 +354,30 @@ tile(Monitor *m)
- return;
- if (n > m->nmaster)
- - mw = m->nmaster ? m->ww * m->mfact : 0;
- + mw = m->nmaster ? m->ww * m->mfact - m->gappx : 0;
- else {
- - mw = m->ww;
- + mw = m->ww - m->gappx;
- if (n > 1 && n < m->nmaster) {
- m->nmaster = n;
- tile(m);
- return;
- }
- }
- - for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- + for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- if (i < m->nmaster) {
- // client is in the master
- - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- - animateclient(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), framecount, 0);
- + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
- + animateclient(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), framecount, 0);
- if (m->nmaster == 1 && n > 1) {
- - mw = c->w + c->bw * 2;
- + mw = c->w + c->bw * 2 + m->gappx;
- }
- if (my + HEIGHT(c) < m->wh)
- - my += HEIGHT(c);
- + my += HEIGHT(c) + m->gappx;
- } else {
- // client is in the stack
- - h = (m->wh - ty) / (n - i);
- - animateclient(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), framecount, 0);
- + h = (m->wh - ty) / (n - i) - m->gappx;
- + animateclient(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), framecount, 0);
- if (ty + HEIGHT(c) < m->wh)
- - ty += HEIGHT(c);
- + ty += HEIGHT(c) + m->gappx;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement