aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-23 14:26:18 -0700
committerFuwn <[email protected]>2024-05-23 14:26:18 -0700
commit766e41c762c8f14c40237930e6a8a1b8d177070f (patch)
tree60a1a7799f1fa2d6c9876e206c67a30cd6187df8
parentMerge pull request #238 from swindlesmccoop/master (diff)
downloadseiwm-766e41c762c8f14c40237930e6a8a1b8d177070f.tar.xz
seiwm-766e41c762c8f14c40237930e6a8a1b8d177070f.zip
feat(dwm.c): add vanitygaps patch
-rw-r--r--config.mk6
-rw-r--r--dwm.c58
2 files changed, 51 insertions, 13 deletions
diff --git a/config.mk b/config.mk
index 0d70060..08b070b 100644
--- a/config.mk
+++ b/config.mk
@@ -7,8 +7,8 @@ VERSION = 6.4
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
+X11INC = /usr/include/X11
+X11LIB = /usr/lib/X11
# Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama
@@ -23,7 +23,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res -lXext
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/dwm.c b/dwm.c
index 1ce854c..f2b9a40 100644
--- a/dwm.c
+++ b/dwm.c
@@ -43,6 +43,7 @@
#endif /* XINERAMA */
#include <X11/Xft/Xft.h>
#include <X11/Xlib-xcb.h>
+#include <X11/extensions/shape.h>
#include <xcb/res.h>
#include "drw.h"
@@ -69,6 +70,27 @@
#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
#define TRUNC(X,A,B) (MAX((A), MIN((X), (B))))
+#define XRDB_LOAD_COLOR(R, V) \
+ if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \
+ if (value.addr != NULL && strnlen(value.addr, 8) == 7 && \
+ value.addr[0] == '#') { \
+ int i = 1; \
+ for (; i <= 6; i++) { \
+ if (value.addr[i] < 48) \
+ break; \
+ if (value.addr[i] > 57 && value.addr[i] < 65) \
+ break; \
+ if (value.addr[i] > 70 && value.addr[i] < 97) \
+ break; \
+ if (value.addr[i] > 102) \
+ break; \
+ } \
+ if (i == 7) { \
+ strncpy(V, value.addr, 7); \
+ V[7] = '\0'; \
+ } \
+ } \
+ }
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@@ -304,6 +326,9 @@ static int bh; /* bar height */
static int lrpad; /* sum of left and right padding for text */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
+static int enablefullscreen = 0;
+static int enableoutergaps = 1;
+static int lrpad; /* sum of left and right padding for text */
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
[ClientMessage] = clientmessage,
@@ -1320,16 +1345,29 @@ maprequest(XEvent *e)
void
monocle(Monitor *m)
{
- unsigned int n;
- int oh, ov, ih, iv;
- Client *c;
-
- getgaps(m, &oh, &ov, &ih, &iv, &n);
-
- if (n > 0) /* override layout symbol */
- snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
- for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
- resize(c, m->wx + ov, m->wy + oh, m->ww - 2 * c->bw - 2 * ov, m->wh - 2 * c->bw - 2 * oh, 0);
+ unsigned int i, n, h, mw, my, ty;
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+
+ 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++)
+ 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);
+ } 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);
+ }
}
void