mirror of
https://github.com/Horhik/dotfiles.git
synced 2025-01-09 17:19:30 +00:00
patch dwm gaps
This commit is contained in:
parent
e16d87dab6
commit
1322fce4de
|
@ -4,6 +4,11 @@
|
||||||
static const unsigned int borderpx = 3; /* border pixel of windows */
|
static const unsigned int borderpx = 3; /* border pixel of windows */
|
||||||
static const unsigned int gappx = 10; /* gap pixel between windows */
|
static const unsigned int gappx = 10; /* gap pixel between windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||||
|
static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||||
|
static const unsigned int gappoh = 20; /* horiz outer gap between windows and screen edge */
|
||||||
|
static const unsigned int gappov = 20; /* vert outer gap between windows and screen edge */
|
||||||
|
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = { "Mononoki Nerd Font:size=10"};
|
static const char *fonts[] = { "Mononoki Nerd Font:size=10"};
|
||||||
|
@ -73,7 +78,7 @@ static const Rule rules[] = {
|
||||||
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
|
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
|
||||||
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
|
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
|
||||||
};
|
};
|
||||||
|
// default gaps
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
|
@ -108,8 +113,6 @@ static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL
|
||||||
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
||||||
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
||||||
static const char *tasks[] = {"t","evolution", NULL};
|
static const char *tasks[] = {"t","evolution", NULL};
|
||||||
|
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
@ -122,6 +125,22 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY|Mod1Mask, XK_h, incrgaps, {.i = +1 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_l, incrgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_h, incrogaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_l, incrogaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ControlMask, XK_h, incrigaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ControlMask, XK_l, incrigaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_0, togglegaps, {0} },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||||
|
{ MODKEY, XK_y, incrihgaps, {.i = +10 } },
|
||||||
|
{ MODKEY, XK_o, incrihgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|ControlMask, XK_y, incrivgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|ControlMask, XK_o, incrivgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_y, incrohgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_o, incrohgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -10 } },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
|
|
@ -70,7 +70,8 @@ static const Rule rules[] = {
|
||||||
{ NULL, NULL, "scratchpad", 0, 1, -1, 's' },
|
{ NULL, NULL, "scratchpad", 0, 1, -1, 's' },
|
||||||
{ NULL, NULL, "sp_volume", 0, 1, -1, 'v' },
|
{ NULL, NULL, "sp_volume", 0, 1, -1, 'v' },
|
||||||
{ NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' },
|
{ NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' },
|
||||||
|
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
|
||||||
|
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
@ -100,13 +101,13 @@ static const Layout layouts[] = {
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL};
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL};
|
||||||
static const char *termcmd[] = { "alacritty", NULL };
|
static const char *termcmd[] = { "alacritty", NULL };
|
||||||
|
|
||||||
static const char *flameshot[] = { "flameshot","gui", NULL };
|
static const char *flameshot[] = { "flameshot","gui", NULL };
|
||||||
|
|
||||||
/*First arg only serves to match against key in rules*/
|
/*First arg only serves to match against key in rules*/
|
||||||
static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL};
|
static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL};
|
||||||
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
||||||
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
||||||
|
static const char *tasks[] = {"t","evolution", NULL};
|
||||||
|
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
|
@ -129,6 +130,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
@ -142,6 +144,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
|
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
|
||||||
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
|
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
|
||||||
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
|
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
|
||||||
|
{ MODKEY, XK_t, togglescratch, {.v = tasks } },
|
||||||
{ MODKEY, XK_n, togglealttag, {0} },
|
{ MODKEY, XK_n, togglealttag, {0} },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
static const unsigned int borderpx = 3; /* border pixel of windows */
|
static const unsigned int borderpx = 3; /* border pixel of windows */
|
||||||
static const unsigned int gappx = 10; /* gap pixel between windows */
|
static const unsigned int gappx = 10; /* gap pixel between windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||||
|
static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||||
|
static const unsigned int gappoh = 20; /* horiz outer gap between windows and screen edge */
|
||||||
|
static const unsigned int gappov = 20; /* vert outer gap between windows and screen edge */
|
||||||
|
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = { "Mononoki Nerd Font:size=10"};
|
static const char *fonts[] = { "Mononoki Nerd Font:size=10"};
|
||||||
|
@ -73,7 +78,7 @@ static const Rule rules[] = {
|
||||||
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
|
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
|
||||||
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
|
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
|
||||||
};
|
};
|
||||||
|
// default gaps
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
|
@ -108,8 +113,6 @@ static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL
|
||||||
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
|
||||||
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
|
||||||
static const char *tasks[] = {"t","evolution", NULL};
|
static const char *tasks[] = {"t","evolution", NULL};
|
||||||
|
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
@ -122,6 +125,22 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY|Mod1Mask, XK_h, incrgaps, {.i = +1 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_l, incrgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_h, incrogaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_l, incrogaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ControlMask, XK_h, incrigaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask|ControlMask, XK_l, incrigaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_0, togglegaps, {0} },
|
||||||
|
{ MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||||
|
{ MODKEY, XK_y, incrihgaps, {.i = +10 } },
|
||||||
|
{ MODKEY, XK_o, incrihgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|ControlMask, XK_y, incrivgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|ControlMask, XK_o, incrivgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_y, incrohgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|Mod1Mask, XK_o, incrohgaps, {.i = -10 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +10 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -10 } },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
@ -144,7 +163,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
|
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
|
||||||
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
|
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
|
||||||
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
|
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
|
||||||
{ MODKEY, XK_e, togglescratch, {.v = tasks } },
|
{ MODKEY, XK_t, togglescratch, {.v = tasks } },
|
||||||
{ MODKEY, XK_n, togglealttag, {0} },
|
{ MODKEY, XK_n, togglealttag, {0} },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
|
|
BIN
dwm-6.2/dwm
BIN
dwm-6.2/dwm
Binary file not shown.
185
dwm-6.2/dwm.c
185
dwm-6.2/dwm.c
|
@ -122,6 +122,10 @@ struct Monitor {
|
||||||
int mx, my, mw, mh; /* screen size */
|
int mx, my, mw, mh; /* screen size */
|
||||||
int wx, wy, ww, wh; /* window area */
|
int wx, wy, ww, wh; /* window area */
|
||||||
int gappx; /* gaps between windows */
|
int gappx; /* gaps between windows */
|
||||||
|
int gappih; /* horizontal gap between windows */
|
||||||
|
int gappiv; /* vertical gap between windows */
|
||||||
|
int gappoh; /* horizontal outer gaps */
|
||||||
|
int gappov; /* vertical outer gaps */
|
||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
|
@ -212,7 +216,16 @@ static void sendmon(Client *c, Monitor *m);
|
||||||
static void setclientstate(Client *c, long state);
|
static void setclientstate(Client *c, long state);
|
||||||
static void setfocus(Client *c);
|
static void setfocus(Client *c);
|
||||||
static void setfullscreen(Client *c, int fullscreen);
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
static void setgaps(const Arg *arg);
|
static void setgaps(int oh, int ov, int ih, int iv);
|
||||||
|
static void incrgaps(const Arg *arg);
|
||||||
|
static void incrigaps(const Arg *arg);
|
||||||
|
static void incrogaps(const Arg *arg);
|
||||||
|
static void incrohgaps(const Arg *arg);
|
||||||
|
static void incrovgaps(const Arg *arg);
|
||||||
|
static void incrihgaps(const Arg *arg);
|
||||||
|
static void incrivgaps(const Arg *arg);
|
||||||
|
static void togglegaps(const Arg *arg);
|
||||||
|
static void defaultgaps(const Arg *arg);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
|
@ -263,6 +276,7 @@ static char stext[256];
|
||||||
static int screen;
|
static int screen;
|
||||||
static int sw, sh; /* X display screen geometry width, height */
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
static int bh, blw = 0; /* bar geometry */
|
static int bh, blw = 0; /* bar geometry */
|
||||||
|
static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
||||||
static int lrpad; /* sum of left and right padding for text */
|
static int lrpad; /* sum of left and right padding for text */
|
||||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
|
@ -708,6 +722,10 @@ createmon(void)
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
m->gappx = gappx;
|
m->gappx = gappx;
|
||||||
|
m->gappih = gappih;
|
||||||
|
m->gappiv = gappiv;
|
||||||
|
m->gappoh = gappoh;
|
||||||
|
m->gappov = gappov;
|
||||||
m->lt[0] = &layouts[0];
|
m->lt[0] = &layouts[0];
|
||||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@ -1663,17 +1681,111 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
c->isfullscreen = 0;
|
c->isfullscreen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void
|
||||||
|
setgaps(int oh, int ov, int ih, int iv)
|
||||||
|
{
|
||||||
|
if (oh < 0) oh = 0;
|
||||||
|
if (ov < 0) ov = 0;
|
||||||
|
if (ih < 0) ih = 0;
|
||||||
|
if (iv < 0) iv = 0;
|
||||||
|
|
||||||
|
selmon->gappoh = oh;
|
||||||
|
selmon->gappov = ov;
|
||||||
|
selmon->gappih = ih;
|
||||||
|
selmon->gappiv = iv;
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setgaps(const Arg *arg)
|
togglegaps(const Arg *arg)
|
||||||
{
|
{
|
||||||
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
enablegaps = !enablegaps;
|
||||||
selmon->gappx = 0;
|
|
||||||
else
|
|
||||||
selmon->gappx += arg->i;
|
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
defaultgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(gappoh, gappov, gappih, gappiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh + arg->i,
|
||||||
|
selmon->gappov + arg->i,
|
||||||
|
selmon->gappih + arg->i,
|
||||||
|
selmon->gappiv + arg->i
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrigaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh,
|
||||||
|
selmon->gappov,
|
||||||
|
selmon->gappih + arg->i,
|
||||||
|
selmon->gappiv + arg->i
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrogaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh + arg->i,
|
||||||
|
selmon->gappov + arg->i,
|
||||||
|
selmon->gappih,
|
||||||
|
selmon->gappiv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrohgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh + arg->i,
|
||||||
|
selmon->gappov,
|
||||||
|
selmon->gappih,
|
||||||
|
selmon->gappiv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrovgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh,
|
||||||
|
selmon->gappov + arg->i,
|
||||||
|
selmon->gappih,
|
||||||
|
selmon->gappiv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrihgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh,
|
||||||
|
selmon->gappov,
|
||||||
|
selmon->gappih + arg->i,
|
||||||
|
selmon->gappiv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
incrivgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
setgaps(
|
||||||
|
selmon->gappoh,
|
||||||
|
selmon->gappov,
|
||||||
|
selmon->gappih,
|
||||||
|
selmon->gappiv + arg->i
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setlayout(const Arg *arg)
|
setlayout(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -1887,40 +1999,39 @@ tagmon(const Arg *arg)
|
||||||
|
|
||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
|
||||||
unsigned int i, n, h, mw, my, ty, ns;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
{
|
||||||
if (n == 0)
|
unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
|
||||||
return;
|
Client *c;
|
||||||
if(n == 1){
|
|
||||||
c = nexttiled(m->clients);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (smartgaps == n) {
|
||||||
|
oe = 0; // outer gaps disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n > m->nmaster){
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0;
|
||||||
ns = m->nmaster > 0 ? 2 : 1;
|
else
|
||||||
}
|
mw = m->ww - 2*m->gappov*oe + m->gappiv*ie;
|
||||||
else{
|
for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
mw = m->ww - m->gappx;
|
if (i < m->nmaster) {
|
||||||
ns = 1;
|
r = MIN(n, m->nmaster) - i;
|
||||||
}
|
h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0);
|
||||||
if (i < m->nmaster) {
|
if (my + HEIGHT(c) + m->gappih*ie < m->wh)
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
my += HEIGHT(c) + m->gappih*ie;
|
||||||
resize(c, m->wx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
|
} else {
|
||||||
if(my + HEIGHT(c) + m->gappx < m->wh)
|
r = n - i;
|
||||||
my += HEIGHT(c) + m->gappx;
|
h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
} else {
|
resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0);
|
||||||
h = (m->wh - ty) / (n - i) - m->gappx;
|
if (ty + HEIGHT(c) + m->gappih*ie < m->wh)
|
||||||
resize(c, m->wx + mw + m->gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
|
ty += HEIGHT(c) + m->gappih*ie;
|
||||||
if(ty + HEIGHT(c) + m->gappx < m->wh)
|
}
|
||||||
ty += HEIGHT(c) + m->gappx;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
togglebar(const Arg *arg)
|
togglebar(const Arg *arg)
|
||||||
|
|
|
@ -1381,6 +1381,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||||
c->oldw = c->w; c->w = wc.width = w;
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
c->oldh = c->h; c->h = wc.height = h;
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
|
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
&& !c->isfullscreen && !c->isfloating) {
|
||||||
|
c->w = wc.width += c->bw * 2;
|
||||||
|
c->h = wc.height += c->bw * 2;
|
||||||
|
wc.border_width = 0;
|
||||||
|
}
|
||||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
|
@ -1,10 +1,88 @@
|
||||||
--- dwm.c
|
--- dwm.c
|
||||||
+++ dwm.c
|
+++ dwm.c
|
||||||
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
|
@@ -119,6 +119,10 @@ struct Monitor {
|
||||||
static void tile(Monitor *);
|
int by; /* bar geometry */
|
||||||
static void togglebar(const Arg *arg);
|
int mx, my, mw, mh; /* screen size */
|
||||||
static void togglefloating(const Arg *arg);
|
int wx, wy, ww, wh; /* window area */
|
||||||
+static void togglefullscr(const Arg *arg);
|
+ int gappih; /* horizontal gap between windows */
|
||||||
static void toggletag(const Arg *arg);
|
+ int gappiv; /* vertical gap between windows */
|
||||||
static void toggleview(const Arg *arg);
|
+ int gappoh; /* horizontal outer gaps */
|
||||||
static void unfocus(Client *c, int setfocus);
|
+ int gappov; /* vertical outer gaps */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -200,6 +204,16 @@ static void sendmon(Client *c, Monitor *m);
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(int oh, int ov, int ih, int iv);
|
||||||
|
+static void incrgaps(const Arg *arg);
|
||||||
|
+static void incrigaps(const Arg *arg);
|
||||||
|
+static void incrogaps(const Arg *arg);
|
||||||
|
+static void incrohgaps(const Arg *arg);
|
||||||
|
+static void incrovgaps(const Arg *arg);
|
||||||
|
+static void incrihgaps(const Arg *arg);
|
||||||
|
+static void incrivgaps(const Arg *arg);
|
||||||
|
+static void togglegaps(const Arg *arg);
|
||||||
|
+static void defaultgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -640,6 +655,10 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappih = gappih;
|
||||||
|
+ m->gappiv = gappiv;
|
||||||
|
+ m->gappoh = gappoh;
|
||||||
|
+ m->gappov = gappov;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -1780,28 +1904,34 @@ tagmon(const Arg *arg)
|
||||||
|
void
|
||||||
|
tile(Monitor *m)
|
||||||
|
{
|
||||||
|
- unsigned int i, n, h, mw, my, ty;
|
||||||
|
+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ if (smartgaps == n) {
|
||||||
|
+ oe = 0; // outer gaps disabled
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (n > m->nmaster)
|
||||||
|
- mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0;
|
||||||
|
else
|
||||||
|
- mw = m->ww;
|
||||||
|
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ mw = m->ww - 2*m->gappov*oe + m->gappiv*ie;
|
||||||
|
+ for (i = 0, my = ty = m->gappoh*oe, 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), 0);
|
||||||
|
- if (my + HEIGHT(c) < m->wh)
|
||||||
|
- my += HEIGHT(c);
|
||||||
|
+ r = MIN(n, m->nmaster) - i;
|
||||||
|
+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
|
+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0);
|
||||||
|
+ if (my + HEIGHT(c) + m->gappih*ie < m->wh)
|
||||||
|
+ my += HEIGHT(c) + m->gappih*ie;
|
||||||
|
} else {
|
||||||
|
- h = (m->wh - ty) / (n - i);
|
||||||
|
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||||
|
- if (ty + HEIGHT(c) < m->wh)
|
||||||
|
- ty += HEIGHT(c);
|
||||||
|
+ r = n - i;
|
||||||
|
+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
|
+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0);
|
||||||
|
+ if (ty + HEIGHT(c) + m->gappih*ie < m->wh)
|
||||||
|
+ ty += HEIGHT(c) + m->gappih*ie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
BIN
dwm-6.2/dwm.o
BIN
dwm-6.2/dwm.o
Binary file not shown.
259
dwm-6.2/patches/dwm-vanitygaps-20190508-6.2.diff
Normal file
259
dwm-6.2/patches/dwm-vanitygaps-20190508-6.2.diff
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
From 20967685d6879bd611a856ade154df19da9ddc7b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stein Gunnar Bakkeby <bakkeby@gmail.com>
|
||||||
|
Date: Wed, 8 May 2019 08:07:14 +0200
|
||||||
|
Subject: [PATCH] Vanity gaps - allows control of both inner and outer gaps
|
||||||
|
between windows and screen edge
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 21 +++++++++
|
||||||
|
dwm.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||||
|
2 files changed, 161 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..0927c2d 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -3,6 +3,11 @@
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
+static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||||
|
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||||
|
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||||
|
+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||||
|
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
|
@@ -70,6 +75,22 @@ static Key keys[] = {
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
+ { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
|
||||||
|
+ { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||||
|
+ { MODKEY, XK_y, incrihgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_o, incrihgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..88f3e04 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -119,6 +119,10 @@ struct Monitor {
|
||||||
|
int by; /* bar geometry */
|
||||||
|
int mx, my, mw, mh; /* screen size */
|
||||||
|
int wx, wy, ww, wh; /* window area */
|
||||||
|
+ int gappih; /* horizontal gap between windows */
|
||||||
|
+ int gappiv; /* vertical gap between windows */
|
||||||
|
+ int gappoh; /* horizontal outer gaps */
|
||||||
|
+ int gappov; /* vertical outer gaps */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -199,6 +203,16 @@ static void sendmon(Client *c, Monitor *m);
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(int oh, int ov, int ih, int iv);
|
||||||
|
+static void incrgaps(const Arg *arg);
|
||||||
|
+static void incrigaps(const Arg *arg);
|
||||||
|
+static void incrogaps(const Arg *arg);
|
||||||
|
+static void incrohgaps(const Arg *arg);
|
||||||
|
+static void incrovgaps(const Arg *arg);
|
||||||
|
+static void incrihgaps(const Arg *arg);
|
||||||
|
+static void incrivgaps(const Arg *arg);
|
||||||
|
+static void togglegaps(const Arg *arg);
|
||||||
|
+static void defaultgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -240,6 +254,7 @@ static char stext[256];
|
||||||
|
static int screen;
|
||||||
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
|
static int bh, blw = 0; /* bar geometry */
|
||||||
|
+static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
||||||
|
static int lrpad; /* sum of left and right padding for text */
|
||||||
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
|
static unsigned int numlockmask = 0;
|
||||||
|
@@ -638,6 +653,10 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappih = gappih;
|
||||||
|
+ m->gappiv = gappiv;
|
||||||
|
+ m->gappoh = gappoh;
|
||||||
|
+ m->gappov = gappov;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+setgaps(int oh, int ov, int ih, int iv)
|
||||||
|
+{
|
||||||
|
+ if (oh < 0) oh = 0;
|
||||||
|
+ if (ov < 0) ov = 0;
|
||||||
|
+ if (ih < 0) ih = 0;
|
||||||
|
+ if (iv < 0) iv = 0;
|
||||||
|
+
|
||||||
|
+ selmon->gappoh = oh;
|
||||||
|
+ selmon->gappov = ov;
|
||||||
|
+ selmon->gappih = ih;
|
||||||
|
+ selmon->gappiv = iv;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+togglegaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ enablegaps = !enablegaps;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+defaultgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(gappoh, gappov, gappih, gappiv);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh + arg->i,
|
||||||
|
+ selmon->gappov + arg->i,
|
||||||
|
+ selmon->gappih + arg->i,
|
||||||
|
+ selmon->gappiv + arg->i
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrigaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh,
|
||||||
|
+ selmon->gappov,
|
||||||
|
+ selmon->gappih + arg->i,
|
||||||
|
+ selmon->gappiv + arg->i
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrogaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh + arg->i,
|
||||||
|
+ selmon->gappov + arg->i,
|
||||||
|
+ selmon->gappih,
|
||||||
|
+ selmon->gappiv
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrohgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh + arg->i,
|
||||||
|
+ selmon->gappov,
|
||||||
|
+ selmon->gappih,
|
||||||
|
+ selmon->gappiv
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrovgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh,
|
||||||
|
+ selmon->gappov + arg->i,
|
||||||
|
+ selmon->gappih,
|
||||||
|
+ selmon->gappiv
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrihgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh,
|
||||||
|
+ selmon->gappov,
|
||||||
|
+ selmon->gappih + arg->i,
|
||||||
|
+ selmon->gappiv
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+incrivgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setgaps(
|
||||||
|
+ selmon->gappoh,
|
||||||
|
+ selmon->gappov,
|
||||||
|
+ selmon->gappih,
|
||||||
|
+ selmon->gappiv + arg->i
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
setlayout(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||||
|
@@ -1673,26 +1797,32 @@ tagmon(const Arg *arg)
|
||||||
|
void
|
||||||
|
tile(Monitor *m)
|
||||||
|
{
|
||||||
|
- unsigned int i, n, h, mw, my, ty;
|
||||||
|
+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ if (smartgaps == n) {
|
||||||
|
+ oe = 0; // outer gaps disabled
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (n > m->nmaster)
|
||||||
|
- mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0;
|
||||||
|
else
|
||||||
|
- mw = m->ww;
|
||||||
|
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ mw = m->ww - 2*m->gappov*oe + m->gappiv*ie;
|
||||||
|
+ for (i = 0, my = ty = m->gappoh*oe, 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), 0);
|
||||||
|
- my += HEIGHT(c);
|
||||||
|
+ r = MIN(n, m->nmaster) - i;
|
||||||
|
+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
|
+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0);
|
||||||
|
+ my += HEIGHT(c) + m->gappih*ie;
|
||||||
|
} else {
|
||||||
|
- h = (m->wh - ty) / (n - i);
|
||||||
|
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||||
|
- ty += HEIGHT(c);
|
||||||
|
+ r = n - i;
|
||||||
|
+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||||
|
+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0);
|
||||||
|
+ ty += HEIGHT(c) + m->gappih*ie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
Loading…
Reference in a new issue