aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordianshi <dianshi@main.lv>2020-04-05 16:09:07 +0100
committerdianshi <dianshi@main.lv>2020-04-05 16:09:07 +0100
commit8ce660c55e1cf481244075430c871d9ec06de3ff (patch)
tree870fc4f090644a2af861d45ec63966d242cfb86d
parent41259cc53bb01ca01564321894ffa027c1fd2928 (diff)
downloaddwm-pixel-master.tar.gz
dwm-pixel-master.zip
Added uselessgapsHEADmaster
-rw-r--r--Kconfig7
-rw-r--r--config.h3
-rw-r--r--dwm.c42
-rw-r--r--kconfig.h1
4 files changed, 52 insertions, 1 deletions
diff --git a/Kconfig b/Kconfig
index c1a3034..b72bc85 100644
--- a/Kconfig
+++ b/Kconfig
@@ -10,4 +10,9 @@ config DWM_ALTERNATIVETAGS
config DWM_URGBORDER
bool "Change urgent message color"
- default n \ No newline at end of file
+ default n
+
+config DWM_USELESSGAP
+ bool "Gap between all windowses"
+ default n
+
diff --git a/config.h b/config.h
index 55eb463..2e2d6a9 100644
--- a/config.h
+++ b/config.h
@@ -2,6 +2,9 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
+#ifdef CONFIG_DWM_USELESSGAP
+static const unsigned int gappx = 6; /* gaps between windows */
+#endif
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
diff --git a/dwm.c b/dwm.c
index 0a1e33e..d12622c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -54,8 +54,15 @@
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+/******************************************************************************/
+#ifdef CONFIG_DWM_USELESSGAP
+#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
+#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
+#else
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
+#endif
+/******************************************************************************/
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
@@ -1379,11 +1386,46 @@ resizeclient(Client *c, int x, int y, int w, int h)
{
XWindowChanges wc;
+/******************************************************************************/
+#ifdef CONFIG_DWM_USELESSGAP
+ unsigned int n;
+ unsigned int gapoffset;
+ unsigned int gapincr;
+ Client *nbc;
+
+ wc.border_width = c->bw;
+
+ /* Get number of clients for the selected monitor */
+ for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++);
+
+ /* Do nothing if layout is floating */
+ if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
+ gapincr = gapoffset = 0;
+ } else {
+ /* Remove border and gap if layout is monocle or only one client */
+ if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) {
+ gapoffset = 0;
+ gapincr = -2 * borderpx;
+ wc.border_width = 0;
+ } else {
+ gapoffset = gappx;
+ gapincr = 2 * gappx;
+ }
+ }
+
+ c->oldx = c->x; c->x = wc.x = x + gapoffset;
+ c->oldy = c->y; c->y = wc.y = y + gapoffset;
+ c->oldw = c->w; c->w = wc.width = w - gapincr;
+ c->oldh = c->h; c->h = wc.height = h - gapincr;
+#else
c->oldx = c->x; c->x = wc.x = x;
c->oldy = c->y; c->y = wc.y = y;
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
wc.border_width = c->bw;
+#endif
+/******************************************************************************/
+
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
diff --git a/kconfig.h b/kconfig.h
index 560e218..3780601 100644
--- a/kconfig.h
+++ b/kconfig.h
@@ -5,4 +5,5 @@
#define CONFIG_DWM_PERTAG
#define CONFIG_DWM_ALTERNATIVETAGS
#define CONFIG_DWM_URGBORDER
+#define CONFIG_DWM_USELESSGAP
#endif