Add dwm patches
parent
bb725bacff
commit
ed0c3e9b5f
|
@ -1,10 +1,10 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
/* Default settings; can be overriden by command line. */
|
/* Default settings; can be overriden by command line. */
|
||||||
|
|
||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
static const char *fonts[] = {
|
static const char *fonts[] = {
|
||||||
"monospace:size=10"
|
"Iosevka:size=10"
|
||||||
};
|
};
|
||||||
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
static const char *colors[SchemeLast][2] = {
|
static const char *colors[SchemeLast][2] = {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -106,7 +106,6 @@ static Button buttons[] = {
|
||||||
/* click event mask button function argument */
|
/* click event mask button function argument */
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int gappx = 5; /* gaps between windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 0; /* 0 means bottom bar */
|
static const int topbar = 0; /* 0 means bottom bar */
|
||||||
|
@ -31,7 +32,7 @@ static const Rule rules[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.62; /* 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 */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ static const Layout layouts[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod4Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
@ -87,6 +88,9 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_minus, setgaps, {.i = -5 } },
|
||||||
|
{ MODKEY, XK_equal, setgaps, {.i = +5 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
|
@ -105,7 +109,6 @@ static Button buttons[] = {
|
||||||
/* click event mask button function argument */
|
/* click event mask button function argument */
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
|
||||||
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
int i;
|
int i;
|
||||||
|
@ -119,6 +119,7 @@ struct Monitor {
|
||||||
int by; /* bar geometry */
|
int by; /* bar geometry */
|
||||||
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 */
|
||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
|
@ -199,6 +200,7 @@ 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 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);
|
||||||
|
@ -441,10 +443,8 @@ buttonpress(XEvent *e)
|
||||||
arg.ui = 1 << i;
|
arg.ui = 1 << i;
|
||||||
} else if (ev->x < x + blw)
|
} else if (ev->x < x + blw)
|
||||||
click = ClkLtSymbol;
|
click = ClkLtSymbol;
|
||||||
else if (ev->x > selmon->ww - TEXTW(stext))
|
|
||||||
click = ClkStatusText;
|
|
||||||
else
|
else
|
||||||
click = ClkWinTitle;
|
click = ClkStatusText;
|
||||||
} else if ((c = wintoclient(ev->window))) {
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
focus(c);
|
focus(c);
|
||||||
restack(selmon);
|
restack(selmon);
|
||||||
|
@ -640,6 +640,7 @@ createmon(void)
|
||||||
m->nmaster = nmaster;
|
m->nmaster = nmaster;
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
|
m->gappx = gappx;
|
||||||
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);
|
||||||
|
@ -731,15 +732,8 @@ drawbar(Monitor *m)
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
if ((w = m->ww - sw - x) > bh) {
|
if ((w = m->ww - sw - x) > bh) {
|
||||||
if (m->sel) {
|
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
|
||||||
if (m->sel->isfloating)
|
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
|
||||||
} else {
|
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
}
|
}
|
||||||
|
@ -1237,11 +1231,8 @@ propertynotify(XEvent *e)
|
||||||
drawbars();
|
drawbars();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
if (c == c->mon->sel)
|
|
||||||
drawbar(c->mon);
|
|
||||||
}
|
|
||||||
if (ev->atom == netatom[NetWMWindowType])
|
if (ev->atom == netatom[NetWMWindowType])
|
||||||
updatewindowtype(c);
|
updatewindowtype(c);
|
||||||
}
|
}
|
||||||
|
@ -1284,6 +1275,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->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);
|
||||||
|
@ -1499,6 +1497,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
|
void
|
||||||
setlayout(const Arg *arg)
|
setlayout(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -1675,26 +1683,35 @@ tagmon(const Arg *arg)
|
||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n, h, mw, my, ty;
|
unsigned int i, n, h, mw, my, ty, ns;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
if(n == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (n > m->nmaster)
|
if (n > m->nmaster){
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
else
|
ns = m->nmaster > 0 ? 2 : 1;
|
||||||
mw = m->ww;
|
}
|
||||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
else{
|
||||||
|
mw = m->ww - m->gappx;
|
||||||
|
ns = 1;
|
||||||
|
}
|
||||||
|
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
resize(c, m->wx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c) + m->gappx;
|
||||||
} else {
|
} else {
|
||||||
h = (m->wh - ty) / (n - i);
|
h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
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);
|
ty += HEIGHT(c) + m->gappx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,81 @@
|
||||||
|
From 969dbbc548f16da5d94630e3d54e9c96c5296520 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ryan Kes <alrayyes@gmail.com>
|
||||||
|
Date: Thu, 28 Mar 2019 14:36:07 +0100
|
||||||
|
Subject: [PATCH] dwm-notitle-6.2
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 1 -
|
||||||
|
dwm.c | 20 ++++----------------
|
||||||
|
2 files changed, 4 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..19330cd 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -102,7 +102,6 @@ static Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
|
- { ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..bcf5cb1 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||||
|
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||||
|
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||||
|
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||||
|
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
|
||||||
|
+ ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
int i;
|
||||||
|
@@ -439,10 +439,8 @@ buttonpress(XEvent *e)
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
} else if (ev->x < x + blw)
|
||||||
|
click = ClkLtSymbol;
|
||||||
|
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||||
|
- click = ClkStatusText;
|
||||||
|
else
|
||||||
|
- click = ClkWinTitle;
|
||||||
|
+ click = ClkStatusText;
|
||||||
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
|
focus(c);
|
||||||
|
restack(selmon);
|
||||||
|
@@ -729,15 +727,8 @@ drawbar(Monitor *m)
|
||||||
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
|
if ((w = m->ww - sw - x) > bh) {
|
||||||
|
- if (m->sel) {
|
||||||
|
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||||
|
- if (m->sel->isfloating)
|
||||||
|
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||||
|
- } else {
|
||||||
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
|
}
|
||||||
|
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
|
||||||
|
drawbars();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
||||||
|
+ if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
|
||||||
|
updatetitle(c);
|
||||||
|
- if (c == c->mon->sel)
|
||||||
|
- drawbar(c->mon);
|
||||||
|
- }
|
||||||
|
if (ev->atom == netatom[NetWMWindowType])
|
||||||
|
updatewindowtype(c);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
diff -up a/config.h b/config.h
|
||||||
|
--- a/config.h 2019-07-21 22:43:04.535873031 +0200
|
||||||
|
+++ b/config.h 2019-07-24 08:48:08.038433535 +0200
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+static const unsigned int gappx = 5; /* gaps between windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 0; /* 0 means bottom bar */
|
||||||
|
@@ -84,6 +85,9 @@ static Key keys[] = {
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_minus, setgaps, {.i = -5 } },
|
||||||
|
+ { MODKEY, XK_equal, setgaps, {.i = +5 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
diff -up a/dwm.c b/dwm.c
|
||||||
|
--- a/dwm.c 2019-07-21 22:43:04.535873031 +0200
|
||||||
|
+++ b/dwm.c 2019-07-24 08:50:44.989360476 +0200
|
||||||
|
@@ -119,6 +119,7 @@ struct Monitor {
|
||||||
|
int by; /* bar geometry */
|
||||||
|
int mx, my, mw, mh; /* screen size */
|
||||||
|
int wx, wy, ww, wh; /* window area */
|
||||||
|
+ int gappx; /* gaps between windows */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -199,6 +200,7 @@ static void sendmon(Client *c, Monitor *
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -638,6 +640,7 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappx = gappx;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -1282,6 +1285,13 @@ resizeclient(Client *c, int x, int y, in
|
||||||
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
|
wc.border_width = c->bw;
|
||||||
|
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange))
|
||||||
|
+ {
|
||||||
|
+ 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);
|
||||||
|
configure(c);
|
||||||
|
XSync(dpy, False);
|
||||||
|
@@ -1498,6 +1508,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)
|
||||||
|
{
|
||||||
|
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||||
|
@@ -1673,26 +1693,35 @@ tagmon(const Arg *arg)
|
||||||
|
void
|
||||||
|
tile(Monitor *m)
|
||||||
|
{
|
||||||
|
- unsigned int i, n, h, mw, my, ty;
|
||||||
|
+ 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)
|
||||||
|
return;
|
||||||
|
+ if(n == 1){
|
||||||
|
+ c = nexttiled(m->clients);
|
||||||
|
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (n > m->nmaster)
|
||||||
|
+ if (n > m->nmaster){
|
||||||
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
- else
|
||||||
|
- mw = m->ww;
|
||||||
|
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ ns = m->nmaster > 0 ? 2 : 1;
|
||||||
|
+ }
|
||||||
|
+ else{
|
||||||
|
+ mw = m->ww - m->gappx;
|
||||||
|
+ ns = 1;
|
||||||
|
+ }
|
||||||
|
+ for (i = 0, my = ty = 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), 0);
|
||||||
|
- 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*(5-ns)/2, h - 2*c->bw, 0);
|
||||||
|
+ my += HEIGHT(c) + m->gappx;
|
||||||
|
} 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);
|
||||||
|
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
|
+ 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->gappx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue