feat: added uselessgap patch

This commit is contained in:
Ryan Kes 2020-12-01 11:28:24 +01:00
parent 0bb5e4dae1
commit ebb984c1b3
3 changed files with 70 additions and 1 deletions

View file

@ -26,6 +26,7 @@ _patches=(
"local-alpha-20201019-61bb8b2.diff"
"dwm-rotatestack-20161021-ab9571b.diff"
"local-statuspadding-20150524-c8e9479.diff"
"local-uselessgap-6.2.diff"
)
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
@ -46,7 +47,8 @@ md5sums=('9929845ccdec4d2cc191f16210dd7f3d'
'595df893d829b2994bb799d12a1c9545'
'3f50d21e606afd5c8b3c67dbbbb9ea32'
'882e0783ccedf9fbb8b565e7681116c9'
'e08026fd0301284fc59b5652da22e994')
'e08026fd0301284fc59b5652da22e994'
'b9c840237160440110fdafc204eff208')
prepare() {
cd $srcdir/dwm-$pkgver

View file

@ -2,6 +2,7 @@
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int gappx = 6; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = -1; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2; /* systray spacing */

66
local-uselessgap-6.2.diff Normal file
View file

@ -0,0 +1,66 @@
diff -up -N a/config.def.h b/config.def.h
--- a/config.def.h 2020-12-01 11:22:39.024878812 +0100
+++ b/config.def.h 2020-12-01 11:23:21.208263865 +0100
@@ -2,6 +2,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
+static const unsigned int gappx = 6; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2; /* systray spacing */
diff -up -N a/dwm.c b/dwm.c
--- a/dwm.c 2020-12-01 11:22:39.024878812 +0100
+++ b/dwm.c 2020-12-01 11:25:30.515086777 +0100
@@ -53,8 +53,8 @@
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
-#define WIDTH(X) ((X)->w + 2 * (X)->bw)
-#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
+#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
+#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
@@ -1505,12 +1505,36 @@ void
resizeclient(Client *c, int x, int y, int w, int h)
{
XWindowChanges wc;
+ unsigned int n;
+ unsigned int gapoffset;
+ unsigned int gapincr;
+ Client *nbc;
- 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;
+
+ /* 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;
+
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
&& !c->isfullscreen && !c->isfloating) {