diff options
author | dianshi <dianshi@main.lv> | 2020-04-05 16:09:07 +0100 |
---|---|---|
committer | dianshi <dianshi@main.lv> | 2020-04-05 16:09:07 +0100 |
commit | 8ce660c55e1cf481244075430c871d9ec06de3ff (patch) | |
tree | 870fc4f090644a2af861d45ec63966d242cfb86d | |
parent | 41259cc53bb01ca01564321894ffa027c1fd2928 (diff) | |
download | dwm-pixel-8ce660c55e1cf481244075430c871d9ec06de3ff.tar.gz dwm-pixel-8ce660c55e1cf481244075430c871d9ec06de3ff.zip |
-rw-r--r-- | Kconfig | 7 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | dwm.c | 42 | ||||
-rw-r--r-- | kconfig.h | 1 |
4 files changed, 52 insertions, 1 deletions
@@ -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 + @@ -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 */ @@ -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); @@ -5,4 +5,5 @@ #define CONFIG_DWM_PERTAG #define CONFIG_DWM_ALTERNATIVETAGS #define CONFIG_DWM_URGBORDER +#define CONFIG_DWM_USELESSGAP #endif |