sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

fullgaps.diff (3468B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 1c0b587..38d2f6c 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -2,6 +2,7 @@
      6  
      7  /* appearance */
      8  static const unsigned int borderpx  = 1;        /* border pixel of windows */
      9 +static const unsigned int gappx     = 5;        /* gaps between windows */
     10  static const unsigned int snap      = 32;       /* snap pixel */
     11  static const int showbar            = 1;        /* 0 means no bar */
     12  static const int topbar             = 1;        /* 0 means bottom bar */
     13 @@ -84,6 +85,9 @@ static Key keys[] = {
     14  	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
     15  	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
     16  	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
     17 +	{ MODKEY,                       XK_minus,  setgaps,        {.i = -1 } },
     18 +	{ MODKEY,                       XK_equal,  setgaps,        {.i = +1 } },
     19 +	{ MODKEY|ShiftMask,             XK_equal,  setgaps,        {.i = 0  } },
     20  	TAGKEYS(                        XK_1,                      0)
     21  	TAGKEYS(                        XK_2,                      1)
     22  	TAGKEYS(                        XK_3,                      2)
     23 diff --git a/dwm.c b/dwm.c
     24 index 4465af1..4363627 100644
     25 --- a/dwm.c
     26 +++ b/dwm.c
     27 @@ -119,6 +119,7 @@ struct Monitor {
     28  	int by;               /* bar geometry */
     29  	int mx, my, mw, mh;   /* screen size */
     30  	int wx, wy, ww, wh;   /* window area  */
     31 +	int gappx;            /* gaps between windows */
     32  	unsigned int seltags;
     33  	unsigned int sellt;
     34  	unsigned int tagset[2];
     35 @@ -199,6 +200,7 @@ static void sendmon(Client *c, Monitor *m);
     36  static void setclientstate(Client *c, long state);
     37  static void setfocus(Client *c);
     38  static void setfullscreen(Client *c, int fullscreen);
     39 +static void setgaps(const Arg *arg);
     40  static void setlayout(const Arg *arg);
     41  static void setmfact(const Arg *arg);
     42  static void setup(void);
     43 @@ -638,6 +640,7 @@ createmon(void)
     44  	m->nmaster = nmaster;
     45  	m->showbar = showbar;
     46  	m->topbar = topbar;
     47 +	m->gappx = gappx;
     48  	m->lt[0] = &layouts[0];
     49  	m->lt[1] = &layouts[1 % LENGTH(layouts)];
     50  	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
     51 @@ -1497,6 +1500,16 @@ setfullscreen(Client *c, int fullscreen)
     52  	}
     53  }
     54  
     55 +void
     56 +setgaps(const Arg *arg)
     57 +{
     58 +	if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
     59 +		selmon->gappx = 0;
     60 +	else
     61 +		selmon->gappx += arg->i;
     62 +	arrange(selmon);
     63 +}
     64 +
     65  void
     66  setlayout(const Arg *arg)
     67  {
     68 @@ -1683,16 +1696,16 @@ tile(Monitor *m)
     69  	if (n > m->nmaster)
     70  		mw = m->nmaster ? m->ww * m->mfact : 0;
     71  	else
     72 -		mw = m->ww;
     73 -	for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
     74 +		mw = m->ww - m->gappx;
     75 +	for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
     76  		if (i < m->nmaster) {
     77 -			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
     78 -			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
     79 -			my += HEIGHT(c);
     80 +			h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
     81 +			resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
     82 +			my += HEIGHT(c) + m->gappx;
     83  		} else {
     84 -			h = (m->wh - ty) / (n - i);
     85 -			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
     86 -			ty += HEIGHT(c);
     87 +			h = (m->wh - ty) / (n - i) - m->gappx;
     88 +			resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
     89 +			ty += HEIGHT(c) + m->gappx;
     90  		}
     91  }
     92  
     93 -- 
     94 2.20.1
     95