2
0
mirror of https://github.com/bakkeby/patches synced 2024-11-11 13:10:25 +00:00

Refactoring base banches for patches.

Various patch upgrades to dwm 6.5.
This commit is contained in:
bakkeby 2024-07-01 23:49:13 +02:00
parent 3aa6a4587c
commit ed9dcc79fd
329 changed files with 35136 additions and 2061 deletions

View File

@ -1,6 +1,6 @@
From 986ee6a3ae3dcdd704b69f1dbd954115246021bf Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 10:47:07 +0200
From 74a0f69fb5f3de2176dcca8ab66ba5f2446d50f2 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:11:17 +0200
Subject: [PATCH] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
@ -293,5 +293,5 @@ index 4465af1..20f8309 100644
zoom(const Arg *arg)
{
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 29ce86e6162c47ee5cd830df5781a572e3fed43e Mon Sep 17 00:00:00 2001
From e70c53b8b4830e41893869c253626645f50396a8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 10:55:28 +0100
Date: Mon, 24 Jun 2024 09:10:04 +0200
Subject: [PATCH] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
@ -293,5 +293,5 @@ index a96f33c..34b9a32 100644
zoom(const Arg *arg)
{
--
2.19.1
2.45.2

View File

@ -0,0 +1,99 @@
From 86e474851df42f8c9ec0af9fb4432ff294b54dc4 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:45:43 +0200
Subject: [PATCH 2/2] alpha deck layout: only show the currently focused window
(rather than all windows stacked on top of each other)
---
config.def.h | 2 ++
dwm.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/config.def.h b/config.def.h
index 4f68fe8..0c52fbf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -48,6 +48,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -83,6 +84,7 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 20f8309..f011388 100644
--- a/dwm.c
+++ b/dwm.c
@@ -159,6 +159,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -652,6 +653,43 @@ createmon(void)
return m;
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ Client *c, *s;
+
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for (i = my = 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), False);
+ my += HEIGHT(c);
+ }
+ else
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+
+ for (s = m->stack; s; s = s->snext) {
+ if (!ISVISIBLE(s) || s->isfloating)
+ continue;
+
+ for (i = my = 0, c = nexttiled(m->clients); c && c != s; c = nexttiled(c->next), i++);
+ if (i < m->nmaster)
+ continue;
+ XMoveWindow(dpy, s->win, c->x, c->y);
+ resize(s, m->wx + mw, m->wy, m->ww - mw - (2*s->bw), m->wh - (2*s->bw), False);
+ break;
+ }
+}
+
void
destroynotify(XEvent *e)
{
@@ -810,6 +848,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == deck)
+ arrangemon(selmon);
drawbars();
}
--
2.45.2

View File

@ -0,0 +1,397 @@
From 74a0f69fb5f3de2176dcca8ab66ba5f2446d50f2 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:11:17 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
Refer to https://dwm.suckless.org/patches/alpha/
Authors:
Eon S. Jeon - esjeon@hyunmu.am
Laslo Hunhold - dev@frign.de (6.1 port)
Thomas Oltmann - thomas.oltmann.hhg@gmail.com (20180613-b69c870 port)
---
config.def.h | 7 ++++++
config.mk | 2 +-
drw.c | 26 ++++++++++++-----------
drw.h | 9 +++++---
dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..4f68fe8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,11 +12,18 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const unsigned int baralpha = 0xd0;
+static const unsigned int borderalpha = OPAQUE;
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+static const unsigned int alphas[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
+ [SchemeSel] = { OPAQUE, baralpha, borderalpha },
+};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/config.mk b/config.mk
index 6d36cb7..3cb1518 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 8fd1ca4..c202cb3 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;
+ Colormap cmap;
Drawable drawable;
GC gc;
Clr *scheme;
@@ -27,7 +30,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c
index 4465af1..20f8309 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,6 +57,8 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define OPAQUE 0xffU
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
@@ -232,6 +234,7 @@ static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
+static void xinitvisual();
static void zoom(const Arg *arg);
/* variables */
@@ -268,6 +271,11 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int useargb = 0;
+static Visual *visual;
+static int depth;
+static Colormap cmap;
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1541,7 +1549,8 @@ setup(void)
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ xinitvisual();
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -1569,7 +1578,7 @@ setup(void)
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
- scheme[i] = drw_scm_create(drw, colors[i], 3);
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
/* init bars */
updatebars();
updatestatus();
@@ -1804,16 +1813,18 @@ updatebars(void)
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
+ .background_pixel = 0,
+ .border_pixel = 0,
+ .colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+void
+xinitvisual()
+{
+ XVisualInfo *infos;
+ XRenderPictFormat *fmt;
+ int nitems;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = screen,
+ .depth = 32,
+ .class = TrueColor
+ };
+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
+
+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
+ visual = NULL;
+ for(i = 0; i < nitems; i ++) {
+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ visual = infos[i].visual;
+ depth = infos[i].depth;
+ cmap = XCreateColormap(dpy, root, visual, AllocNone);
+ useargb = 1;
+ break;
+ }
+ }
+
+ XFree(infos);
+
+ if (! visual) {
+ visual = DefaultVisual(dpy, screen);
+ depth = DefaultDepth(dpy, screen);
+ cmap = DefaultColormap(dpy, screen);
+ }
+}
+
void
zoom(const Arg *arg)
{
--
2.45.2
From 86e474851df42f8c9ec0af9fb4432ff294b54dc4 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:45:43 +0200
Subject: [PATCH 2/2] alpha deck layout: only show the currently focused window
(rather than all windows stacked on top of each other)
---
config.def.h | 2 ++
dwm.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/config.def.h b/config.def.h
index 4f68fe8..0c52fbf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -48,6 +48,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -83,6 +84,7 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 20f8309..f011388 100644
--- a/dwm.c
+++ b/dwm.c
@@ -159,6 +159,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -652,6 +653,43 @@ createmon(void)
return m;
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ Client *c, *s;
+
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for (i = my = 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), False);
+ my += HEIGHT(c);
+ }
+ else
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+
+ for (s = m->stack; s; s = s->snext) {
+ if (!ISVISIBLE(s) || s->isfloating)
+ continue;
+
+ for (i = my = 0, c = nexttiled(m->clients); c && c != s; c = nexttiled(c->next), i++);
+ if (i < m->nmaster)
+ continue;
+ XMoveWindow(dpy, s->win, c->x, c->y);
+ resize(s, m->wx + mw, m->wy, m->ww - mw - (2*s->bw), m->wh - (2*s->bw), False);
+ break;
+ }
+}
+
void
destroynotify(XEvent *e)
{
@@ -810,6 +848,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == deck)
+ arrangemon(selmon);
drawbars();
}
--
2.45.2

View File

@ -0,0 +1,99 @@
From 1833012eaeb223b2034b98e17ac3dd08d8da0c0c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:49:44 +0200
Subject: [PATCH 2/2] alpha deck layout: only show the currently focused window
(rather than all windows stacked on top of each other)
---
config.def.h | 2 ++
dwm.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/config.def.h b/config.def.h
index ca7a9ba..445701a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -49,6 +49,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -84,6 +85,7 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 34b9a32..c3b0651 100644
--- a/dwm.c
+++ b/dwm.c
@@ -159,6 +159,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -653,6 +654,43 @@ createmon(void)
return m;
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ Client *c, *s;
+
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for (i = my = 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), False);
+ my += HEIGHT(c);
+ }
+ else
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+
+ for (s = m->stack; s; s = s->snext) {
+ if (!ISVISIBLE(s) || s->isfloating)
+ continue;
+
+ for (i = my = 0, c = nexttiled(m->clients); c && c != s; c = nexttiled(c->next), i++);
+ if (i < m->nmaster)
+ continue;
+ XMoveWindow(dpy, s->win, c->x, c->y);
+ resize(s, m->wx + mw, m->wy, m->ww - mw - (2*s->bw), m->wh - (2*s->bw), False);
+ break;
+ }
+}
+
void
destroynotify(XEvent *e)
{
@@ -814,6 +852,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == deck)
+ arrangemon(selmon);
drawbars();
}
--
2.45.2

View File

@ -0,0 +1,397 @@
From e70c53b8b4830e41893869c253626645f50396a8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:10:04 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
Refer to https://dwm.suckless.org/patches/alpha/
Authors:
Eon S. Jeon - esjeon@hyunmu.am
Laslo Hunhold - dev@frign.de (6.1 port)
Thomas Oltmann - thomas.oltmann.hhg@gmail.com (20180613-b69c870 port)
---
config.def.h | 7 ++++++
config.mk | 2 +-
drw.c | 26 ++++++++++++-----------
drw.h | 9 +++++---
dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/config.def.h b/config.def.h
index a2ac963..ca7a9ba 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,11 +12,18 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const unsigned int baralpha = 0xd0;
+static const unsigned int borderalpha = OPAQUE;
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+static const unsigned int alphas[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
+ [SchemeSel] = { OPAQUE, baralpha, borderalpha },
+};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/config.mk b/config.mk
index b6eb7e0..848aef9 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 4cdbcbe..fe3aadd 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -194,21 +197,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -218,7 +222,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -274,9 +278,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;
+ Colormap cmap;
Drawable drawable;
GC gc;
Clr *scheme;
@@ -27,7 +30,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c
index a96f33c..34b9a32 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,6 +57,8 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define OPAQUE 0xffU
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
@@ -233,6 +235,7 @@ static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
+static void xinitvisual();
static void zoom(const Arg *arg);
/* variables */
@@ -269,6 +272,11 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int useargb = 0;
+static Visual *visual;
+static int depth;
+static Colormap cmap;
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1545,7 +1553,8 @@ setup(void)
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ xinitvisual();
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -1573,7 +1582,7 @@ setup(void)
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
- scheme[i] = drw_scm_create(drw, colors[i], 3);
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
/* init bars */
updatebars();
updatestatus();
@@ -1810,16 +1819,18 @@ updatebars(void)
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
+ .background_pixel = 0,
+ .border_pixel = 0,
+ .colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
@@ -2116,6 +2127,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+void
+xinitvisual()
+{
+ XVisualInfo *infos;
+ XRenderPictFormat *fmt;
+ int nitems;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = screen,
+ .depth = 32,
+ .class = TrueColor
+ };
+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
+
+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
+ visual = NULL;
+ for(i = 0; i < nitems; i ++) {
+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ visual = infos[i].visual;
+ depth = infos[i].depth;
+ cmap = XCreateColormap(dpy, root, visual, AllocNone);
+ useargb = 1;
+ break;
+ }
+ }
+
+ XFree(infos);
+
+ if (! visual) {
+ visual = DefaultVisual(dpy, screen);
+ depth = DefaultDepth(dpy, screen);
+ cmap = DefaultColormap(dpy, screen);
+ }
+}
+
void
zoom(const Arg *arg)
{
--
2.45.2
From 1833012eaeb223b2034b98e17ac3dd08d8da0c0c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:49:44 +0200
Subject: [PATCH 2/2] alpha deck layout: only show the currently focused window
(rather than all windows stacked on top of each other)
---
config.def.h | 2 ++
dwm.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/config.def.h b/config.def.h
index ca7a9ba..445701a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -49,6 +49,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -84,6 +85,7 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 34b9a32..c3b0651 100644
--- a/dwm.c
+++ b/dwm.c
@@ -159,6 +159,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -653,6 +654,43 @@ createmon(void)
return m;
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ Client *c, *s;
+
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for (i = my = 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), False);
+ my += HEIGHT(c);
+ }
+ else
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+
+ for (s = m->stack; s; s = s->snext) {
+ if (!ISVISIBLE(s) || s->isfloating)
+ continue;
+
+ for (i = my = 0, c = nexttiled(m->clients); c && c != s; c = nexttiled(c->next), i++);
+ if (i < m->nmaster)
+ continue;
+ XMoveWindow(dpy, s->win, c->x, c->y);
+ resize(s, m->wx + mw, m->wy, m->ww - mw - (2*s->bw), m->wh - (2*s->bw), False);
+ break;
+ }
+}
+
void
destroynotify(XEvent *e)
{
@@ -814,6 +852,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == deck)
+ arrangemon(selmon);
drawbars();
}
--
2.45.2

View File

@ -0,0 +1,43 @@
From 0c1f89828b3a8f8589e4f56f7ea47a476822cdf3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:51:46 +0200
Subject: [PATCH 2/2] alpha monocle layout: only show the currently focused
window (rather than all windows stacked on top of each other)
---
dwm.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 20f8309..40059e4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -810,6 +810,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == monocle)
+ arrangemon(selmon);
drawbars();
}
@@ -1119,8 +1121,15 @@ monocle(Monitor *m)
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))
+ for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext);
+ if (c && !c->isfloating) {
+ XMoveWindow(dpy, c->win, m->wx, m->wy);
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+ c = c->snext;
+ }
+ for (; c; c = c->snext)
+ if (!c->isfloating && ISVISIBLE(c))
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
void
--
2.45.2

View File

@ -0,0 +1,341 @@
From 74a0f69fb5f3de2176dcca8ab66ba5f2446d50f2 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:11:17 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
Refer to https://dwm.suckless.org/patches/alpha/
Authors:
Eon S. Jeon - esjeon@hyunmu.am
Laslo Hunhold - dev@frign.de (6.1 port)
Thomas Oltmann - thomas.oltmann.hhg@gmail.com (20180613-b69c870 port)
---
config.def.h | 7 ++++++
config.mk | 2 +-
drw.c | 26 ++++++++++++-----------
drw.h | 9 +++++---
dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..4f68fe8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,11 +12,18 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const unsigned int baralpha = 0xd0;
+static const unsigned int borderalpha = OPAQUE;
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+static const unsigned int alphas[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
+ [SchemeSel] = { OPAQUE, baralpha, borderalpha },
+};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/config.mk b/config.mk
index 6d36cb7..3cb1518 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 8fd1ca4..c202cb3 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;
+ Colormap cmap;
Drawable drawable;
GC gc;
Clr *scheme;
@@ -27,7 +30,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c
index 4465af1..20f8309 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,6 +57,8 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define OPAQUE 0xffU
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
@@ -232,6 +234,7 @@ static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
+static void xinitvisual();
static void zoom(const Arg *arg);
/* variables */
@@ -268,6 +271,11 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int useargb = 0;
+static Visual *visual;
+static int depth;
+static Colormap cmap;
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1541,7 +1549,8 @@ setup(void)
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ xinitvisual();
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -1569,7 +1578,7 @@ setup(void)
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
- scheme[i] = drw_scm_create(drw, colors[i], 3);
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
/* init bars */
updatebars();
updatestatus();
@@ -1804,16 +1813,18 @@ updatebars(void)
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
+ .background_pixel = 0,
+ .border_pixel = 0,
+ .colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+void
+xinitvisual()
+{
+ XVisualInfo *infos;
+ XRenderPictFormat *fmt;
+ int nitems;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = screen,
+ .depth = 32,
+ .class = TrueColor
+ };
+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
+
+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
+ visual = NULL;
+ for(i = 0; i < nitems; i ++) {
+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ visual = infos[i].visual;
+ depth = infos[i].depth;
+ cmap = XCreateColormap(dpy, root, visual, AllocNone);
+ useargb = 1;
+ break;
+ }
+ }
+
+ XFree(infos);
+
+ if (! visual) {
+ visual = DefaultVisual(dpy, screen);
+ depth = DefaultDepth(dpy, screen);
+ cmap = DefaultColormap(dpy, screen);
+ }
+}
+
void
zoom(const Arg *arg)
{
--
2.45.2
From 0c1f89828b3a8f8589e4f56f7ea47a476822cdf3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:51:46 +0200
Subject: [PATCH 2/2] alpha monocle layout: only show the currently focused
window (rather than all windows stacked on top of each other)
---
dwm.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 20f8309..40059e4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -810,6 +810,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == monocle)
+ arrangemon(selmon);
drawbars();
}
@@ -1119,8 +1121,15 @@ monocle(Monitor *m)
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))
+ for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext);
+ if (c && !c->isfloating) {
+ XMoveWindow(dpy, c->win, m->wx, m->wy);
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+ c = c->snext;
+ }
+ for (; c; c = c->snext)
+ if (!c->isfloating && ISVISIBLE(c))
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
void
--
2.45.2

View File

@ -0,0 +1,43 @@
From f3331b857bdb29a3b1ad504623a57e10d0949f8f Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:52:05 +0200
Subject: [PATCH 2/2] alpha monocle layout: only show the currently focused
window (rather than all windows stacked on top of each other)
---
dwm.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 34b9a32..132bc15 100644
--- a/dwm.c
+++ b/dwm.c
@@ -814,6 +814,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == monocle)
+ arrangemon(selmon);
drawbars();
}
@@ -1123,8 +1125,15 @@ monocle(Monitor *m)
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))
+ for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext);
+ if (c && !c->isfloating) {
+ XMoveWindow(dpy, c->win, m->wx, m->wy);
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+ c = c->snext;
+ }
+ for (; c; c = c->snext)
+ if (!c->isfloating && ISVISIBLE(c))
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
void
--
2.45.2

View File

@ -0,0 +1,341 @@
From e70c53b8b4830e41893869c253626645f50396a8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:10:04 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
Refer to https://dwm.suckless.org/patches/alpha/
Authors:
Eon S. Jeon - esjeon@hyunmu.am
Laslo Hunhold - dev@frign.de (6.1 port)
Thomas Oltmann - thomas.oltmann.hhg@gmail.com (20180613-b69c870 port)
---
config.def.h | 7 ++++++
config.mk | 2 +-
drw.c | 26 ++++++++++++-----------
drw.h | 9 +++++---
dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/config.def.h b/config.def.h
index a2ac963..ca7a9ba 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,11 +12,18 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const unsigned int baralpha = 0xd0;
+static const unsigned int borderalpha = OPAQUE;
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+static const unsigned int alphas[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
+ [SchemeSel] = { OPAQUE, baralpha, borderalpha },
+};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/config.mk b/config.mk
index b6eb7e0..848aef9 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 4cdbcbe..fe3aadd 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -194,21 +197,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -218,7 +222,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -274,9 +278,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;
+ Colormap cmap;
Drawable drawable;
GC gc;
Clr *scheme;
@@ -27,7 +30,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c
index a96f33c..34b9a32 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,6 +57,8 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define OPAQUE 0xffU
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
@@ -233,6 +235,7 @@ static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
+static void xinitvisual();
static void zoom(const Arg *arg);
/* variables */
@@ -269,6 +272,11 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int useargb = 0;
+static Visual *visual;
+static int depth;
+static Colormap cmap;
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1545,7 +1553,8 @@ setup(void)
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ xinitvisual();
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -1573,7 +1582,7 @@ setup(void)
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
- scheme[i] = drw_scm_create(drw, colors[i], 3);
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
/* init bars */
updatebars();
updatestatus();
@@ -1810,16 +1819,18 @@ updatebars(void)
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
+ .background_pixel = 0,
+ .border_pixel = 0,
+ .colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
@@ -2116,6 +2127,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+void
+xinitvisual()
+{
+ XVisualInfo *infos;
+ XRenderPictFormat *fmt;
+ int nitems;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = screen,
+ .depth = 32,
+ .class = TrueColor
+ };
+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
+
+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
+ visual = NULL;
+ for(i = 0; i < nitems; i ++) {
+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ visual = infos[i].visual;
+ depth = infos[i].depth;
+ cmap = XCreateColormap(dpy, root, visual, AllocNone);
+ useargb = 1;
+ break;
+ }
+ }
+
+ XFree(infos);
+
+ if (! visual) {
+ visual = DefaultVisual(dpy, screen);
+ depth = DefaultDepth(dpy, screen);
+ cmap = DefaultColormap(dpy, screen);
+ }
+}
+
void
zoom(const Arg *arg)
{
--
2.45.2
From f3331b857bdb29a3b1ad504623a57e10d0949f8f Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:52:05 +0200
Subject: [PATCH 2/2] alpha monocle layout: only show the currently focused
window (rather than all windows stacked on top of each other)
---
dwm.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 34b9a32..132bc15 100644
--- a/dwm.c
+++ b/dwm.c
@@ -814,6 +814,8 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
+ if (selmon->lt[selmon->sellt]->arrange == monocle)
+ arrangemon(selmon);
drawbars();
}
@@ -1123,8 +1125,15 @@ monocle(Monitor *m)
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))
+ for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext);
+ if (c && !c->isfloating) {
+ XMoveWindow(dpy, c->win, m->wx, m->wy);
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+ c = c->snext;
+ }
+ for (; c; c = c->snext)
+ if (!c->isfloating && ISVISIBLE(c))
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
void
--
2.45.2

View File

@ -1,6 +1,6 @@
From 71e4f843ed84d2a6f86dc1aeb516adec5d222194 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 10:53:35 +0200
From c71753a454371b96573d6cf4e250ae977fdb9113 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:40:14 +0200
Subject: [PATCH 2/2] Adding systray patch
Refer to https://dwm.suckless.org/patches/systray/
@ -719,5 +719,5 @@ index 20f8309..679beb0 100644
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 986ee6a3ae3dcdd704b69f1dbd954115246021bf Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 10:47:07 +0200
From 74a0f69fb5f3de2176dcca8ab66ba5f2446d50f2 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:11:17 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
@ -293,12 +293,12 @@ index 4465af1..20f8309 100644
zoom(const Arg *arg)
{
--
2.19.1
2.45.2
From 71e4f843ed84d2a6f86dc1aeb516adec5d222194 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 10:53:35 +0200
From c71753a454371b96573d6cf4e250ae977fdb9113 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:40:14 +0200
Subject: [PATCH 2/2] Adding systray patch
Refer to https://dwm.suckless.org/patches/systray/
@ -1017,5 +1017,5 @@ index 20f8309..679beb0 100644
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 14803952902c1cbde814bc1233a6c0d766a0febf Mon Sep 17 00:00:00 2001
From 91b971e6e8961ff9aad86d190c040604db17b523 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:45:19 +0100
Date: Mon, 24 Jun 2024 09:41:39 +0200
Subject: [PATCH 2/2] Adding systray patch
Refer to https://dwm.suckless.org/patches/systray/
@ -717,5 +717,5 @@ index 34b9a32..2ae3e2b 100644
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 29ce86e6162c47ee5cd830df5781a572e3fed43e Mon Sep 17 00:00:00 2001
From e70c53b8b4830e41893869c253626645f50396a8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 10:55:28 +0100
Date: Mon, 24 Jun 2024 09:10:04 +0200
Subject: [PATCH 1/2] Alpha, adds transparency for the status bar.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
@ -293,12 +293,12 @@ index a96f33c..34b9a32 100644
zoom(const Arg *arg)
{
--
2.19.1
2.45.2
From 14803952902c1cbde814bc1233a6c0d766a0febf Mon Sep 17 00:00:00 2001
From 91b971e6e8961ff9aad86d190c040604db17b523 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:45:19 +0100
Date: Mon, 24 Jun 2024 09:41:39 +0200
Subject: [PATCH 2/2] Adding systray patch
Refer to https://dwm.suckless.org/patches/systray/
@ -1015,5 +1015,5 @@ index 34b9a32..2ae3e2b 100644
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 487cbc072eeff0051a43048b60c45d2f06bc2631 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Thu, 23 Apr 2020 10:06:18 +0200
From 30fd6fb42eb1c9904c7f040c34a0f26588383a4d Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:53:10 +0200
Subject: [PATCH] attachbottom patch
New clients attach at the bottom of the stack instead of the top.
@ -67,5 +67,5 @@ index 4465af1..bf13d15 100644
}
if (m == selmon)
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2b0aa06acb2ce04d8761cfd993adf069e9abb9ab Mon Sep 17 00:00:00 2001
From 72d57efb6520e3a14a09bec7fb9afa11f6c6a53e Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:11:00 +0100
Date: Mon, 24 Jun 2024 09:53:55 +0200
Subject: [PATCH] attachbottom patch
New clients attach at the bottom of the stack instead of the top.
@ -67,5 +67,5 @@ index a96f33c..15b0138 100644
}
if (m == selmon)
--
2.19.1
2.45.2

View File

@ -0,0 +1,71 @@
From c9ccb7661ee3b6fd9fca170a57b53d9e842c74e8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:53:55 +0200
Subject: [PATCH] attachbottom patch
New clients attach at the bottom of the stack instead of the top.
---
dwm.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dwm.c b/dwm.c
index f1d86b2..f2edb49 100644
--- a/dwm.c
+++ b/dwm.c
@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachbottom(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -408,6 +409,18 @@ attach(Client *c)
c->mon->clients = c;
}
+void
+attachbottom(Client *c)
+{
+ Client *below = c->mon->clients;
+ for (; below && below->next; below = below->next);
+ c->next = NULL;
+ if (below)
+ below->next = c;
+ else
+ c->mon->clients = c;
+}
+
void
attachstack(Client *c)
{
@@ -1074,7 +1087,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachbottom(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@@ -1427,7 +1440,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
- attach(c);
+ attachbottom(c);
attachstack(c);
focus(NULL);
arrange(NULL);
@@ -1915,7 +1928,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)
--
2.45.2

View File

@ -1,22 +1,13 @@
From dbbd234a9a3f82a29b3e82a205f4e4ee88371b6a Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 12:27:21 +0200
Subject: [PATCH] Adding attachx patch (combined attach
From aeded80685416b997be074b0fc1180d626fb65db Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:56:38 +0200
Subject: [PATCH] Adding attachx patch (combined attach
above/below/bottom/aside/master patch)
This includes the following attach modes:
0 - master (default behaviour): new windows become the new master
1 - attachabove: new window is placed above selected client
2 - attachaside: new window is placed on top of the stack
3 - attachbelow: new window is placed below selected client
4 - attachbottom: new window is placed at the bottom of the stack
Refer to:
https://dwm.suckless.org/patches/attachabove/
https://dwm.suckless.org/patches/attachaside/
https://dwm.suckless.org/patches/attachbelow/
https://dwm.suckless.org/patches/attachbottom/
---
config.def.h | 1 +
dwm.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++---
@ -133,5 +124,5 @@ index 4465af1..8667baa 100644
focus(NULL);
arrange(NULL);
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 8481cf0e5f3879a19c69385917f4775f529f1ff4 Mon Sep 17 00:00:00 2001
From 32323d32d43fcd782d62d4c34ab4feab041347c4 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:12:29 +0100
Date: Wed, 26 Jun 2024 10:07:59 +0200
Subject: [PATCH] Adding attachx patch (combined attach
above/below/bottom/aside/master patch)
@ -133,5 +133,5 @@ index a96f33c..10fbeef 100644
focus(NULL);
arrange(NULL);
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 071da39aca72871cb433e1dbfc439a31ebf5c502 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 12:28:17 +0200
From 191c3a690ecfaf09708a2843e3a4682e8d8aa59c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:55:15 +0200
Subject: [PATCH] Adding autostart patch
Refer to https://dwm.suckless.org/patches/autostart/
@ -47,5 +47,5 @@ index 4465af1..e634dc1 100644
cleanup();
XCloseDisplay(dpy);
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From b27822d126334b6fd5bf5265fff201e54f4d8ede Mon Sep 17 00:00:00 2001
From 788b6667e121ad234fb8dab6c5ab962b0dd9d8c4 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:13:09 +0100
Date: Mon, 24 Jun 2024 09:55:42 +0200
Subject: [PATCH] Adding autostart patch
Refer to https://dwm.suckless.org/patches/autostart/
@ -47,5 +47,5 @@ index a96f33c..0fad144 100644
cleanup();
XCloseDisplay(dpy);
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 15f09e0e690328cb7bfd35b577435cba7b2e4859 Mon Sep 17 00:00:00 2001
From fdd7f85a71dd137e9e3ea313ce8c1588ba61d51a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 12 Jun 2023 15:17:51 +0200
Date: Mon, 24 Jun 2024 09:58:13 +0200
Subject: [PATCH] Banish patch - behaviour similiar to xbanish and unclutter
---
@ -327,5 +327,5 @@ index e5efb6a..bb7760b 100644
showhide(Client *c)
{
--
2.19.1
2.45.2

331
dwm/dwm-banish-6.5.diff Normal file
View File

@ -0,0 +1,331 @@
From 22abfa4fbe8795594dbc8b04b42a140eba021c4c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:58:13 +0200
Subject: [PATCH] Banish patch - behaviour similiar to xbanish and unclutter
---
config.mk | 6 ++-
dwm.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 149 insertions(+), 7 deletions(-)
diff --git a/config.mk b/config.mk
index 8efca9a..220f4a9 100644
--- a/config.mk
+++ b/config.mk
@@ -14,6 +14,10 @@ X11LIB = /usr/X11R6/lib
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
+# Banish: dependency on libxi and libxfixes for mouse related features
+XINPUTLIBS = -lXi
+XFIXESLIBS = -lXfixes
+
# freetype
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
@@ -23,7 +27,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XINPUTLIBS} ${XFIXESLIBS}
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/dwm.c b/dwm.c
index f1d86b2..0b554f9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <time.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
@@ -39,6 +40,8 @@
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/XInput2.h>
#include <X11/Xft/Xft.h>
#include "drw.h"
@@ -49,6 +52,8 @@
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
+#define INTERSECTC(X,Y,W,H,Z) (MAX(0, MIN((X)+(W),(Z)->x+(Z)->w) - MAX((X),(Z)->x)) \
+ * MAX(0, MIN((Y)+(H),(Z)->y+(Z)->h) - MAX((Y),(Z)->y)))
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
@@ -169,12 +174,14 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static void genericevent(XEvent *e);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
+static void hidecursor(const Arg *arg);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
@@ -185,9 +192,11 @@ static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
+static unsigned long long now(void);
static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
+static Client *recttoclient(int x, int y, int w, int h, int include_floating);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
@@ -204,6 +213,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
+static void showcursor(const Arg *arg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
@@ -243,6 +253,14 @@ 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 cursor_hidden = 0;
+/* mouse_x and mouse_y are used to store the actual co-ordinates of the mouse cursor when
+ * hidden. These can be manipulated freely, e.g. when using the warp patch, to set a new
+ * cursor position for when the cursor is to be revealed again. */
+static int mouse_x = 0;
+static int mouse_y = 0;
+static int xi_opcode;
+static unsigned long long last_button_press = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
[ClientMessage] = clientmessage,
@@ -251,6 +269,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
[Expose] = expose,
+ [GenericEvent] = genericevent,
[FocusIn] = focusin,
[KeyPress] = keypress,
[MappingNotify] = mappingnotify,
@@ -431,7 +450,20 @@ buttonpress(XEvent *e)
selmon = m;
focus(NULL);
}
- if (ev->window == selmon->barwin) {
+
+ c = wintoclient(ev->window);
+
+ if (!c && cursor_hidden) {
+ c = recttoclient(mouse_x, mouse_y, 1, 1, 1);
+ showcursor(NULL);
+ }
+
+ if (c) {
+ focus(c);
+ restack(selmon);
+ XAllowEvents(dpy, ReplayPointer, CurrentTime);
+ click = ClkClientWin;
+ } else if (ev->window == selmon->barwin) {
i = x = 0;
do
x += TEXTW(tags[i]);
@@ -445,16 +477,14 @@ buttonpress(XEvent *e)
click = ClkStatusText;
else
click = ClkWinTitle;
- } else if ((c = wintoclient(ev->window))) {
- focus(c);
- restack(selmon);
- XAllowEvents(dpy, ReplayPointer, CurrentTime);
- click = ClkClientWin;
}
+
for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
+
+ last_button_press = now();
}
void
@@ -764,6 +794,9 @@ enternotify(XEvent *e)
Monitor *m;
XCrossingEvent *ev = &e->xcrossing;
+ if (cursor_hidden)
+ return;
+
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
return;
c = wintoclient(ev->window);
@@ -861,6 +894,36 @@ focusstack(const Arg *arg)
}
}
+void
+genericevent(XEvent *e)
+{
+ if (e->xcookie.extension != xi_opcode)
+ return;
+
+ if (!XGetEventData(dpy, &e->xcookie))
+ return;
+
+ switch (e->xcookie.evtype) {
+ case XI_RawMotion:
+ if (cursor_hidden)
+ showcursor(NULL);
+ break;
+ case XI_RawTouchBegin:
+ case XI_RawTouchEnd:
+ case XI_RawTouchUpdate:
+ if (!cursor_hidden)
+ hidecursor(NULL);
+ break;
+ case XI_RawKeyRelease:
+ if (now() - last_button_press > 2000 && !cursor_hidden) {
+ hidecursor(NULL);
+ }
+ break;
+ }
+
+ XFreeEventData(dpy, &e->xcookie);
+}
+
Atom
getatomprop(Client *c, Atom prop)
{
@@ -884,6 +947,12 @@ getrootptr(int *x, int *y)
unsigned int dui;
Window dummy;
+ if (cursor_hidden) {
+ *x = mouse_x;
+ *y = mouse_y;
+ return 1;
+ }
+
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
}
@@ -977,6 +1046,20 @@ grabkeys(void)
}
}
+void
+hidecursor(const Arg *arg)
+{
+ if (cursor_hidden)
+ return;
+
+ XFixesHideCursor(dpy, root);
+ if (getrootptr(&mouse_x, &mouse_y)) {
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mx + selmon->mw, selmon->my);
+ }
+
+ cursor_hidden = 1;
+}
+
void
incnmaster(const Arg *arg)
{
@@ -1209,6 +1292,13 @@ nexttiled(Client *c)
return c;
}
+unsigned long long
+now(void) {
+ struct timespec currentTime;
+ clock_gettime(CLOCK_REALTIME, &currentTime);
+ return currentTime.tv_sec * 1000LL + currentTime.tv_nsec / 1000000LL;
+}
+
void
pop(Client *c)
{
@@ -1261,6 +1351,23 @@ quit(const Arg *arg)
running = 0;
}
+Client *
+recttoclient(int x, int y, int w, int h, int include_floating)
+{
+ Client *c, *r = NULL;
+ int a, area = 1;
+
+ for (c = selmon->stack; c; c = c->snext) {
+ if (!ISVISIBLE(c) || (c->isfloating && !include_floating))
+ continue;
+ if ((a = INTERSECTC(x, y, w, h, c)) >= area) {
+ area = a;
+ r = c;
+ }
+ }
+ return r;
+}
+
Monitor *
recttomon(int x, int y, int w, int h)
{
@@ -1609,6 +1716,25 @@ setup(void)
|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
+
+ if (!XQueryExtension(dpy, "XInputExtension", &xi_opcode, &i, &i)) {
+ fprintf(stderr, "Warning: XInput is not available.");
+ }
+ /* Tell XInput to send us all RawMotion events. */
+ unsigned char mask_bytes[XIMaskLen(XI_LASTEVENT)];
+ memset(mask_bytes, 0, sizeof(mask_bytes));
+ XISetMask(mask_bytes, XI_RawMotion);
+ XISetMask(mask_bytes, XI_RawKeyRelease);
+ XISetMask(mask_bytes, XI_RawTouchBegin);
+ XISetMask(mask_bytes, XI_RawTouchEnd);
+ XISetMask(mask_bytes, XI_RawTouchUpdate);
+
+ XIEventMask mask;
+ mask.deviceid = XIAllMasterDevices;
+ mask.mask_len = sizeof(mask_bytes);
+ mask.mask = mask_bytes;
+ XISelectEvents(dpy, root, &mask, 1);
+
grabkeys();
focus(NULL);
}
@@ -1626,6 +1752,18 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
+void
+showcursor(const Arg *arg)
+{
+ if (!cursor_hidden)
+ return;
+
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, mouse_x, mouse_y);
+ XFixesShowCursor(dpy, root);
+
+ cursor_hidden = 0;
+}
+
void
showhide(Client *c)
{
--
2.45.2

View File

@ -1,6 +1,6 @@
From f1c11a763cb6943839c4e66c419bd84bd1b32459 Mon Sep 17 00:00:00 2001
From 2d9dd6a13f402f61e890cbbac4234f7c821bd1de Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Thu, 21 Sep 2023 11:01:56 +0200
Date: Mon, 24 Jun 2024 09:59:29 +0200
Subject: [PATCH 2/2] Adding cursorwarp patch on top of banish
---
@ -74,5 +74,5 @@ index bb7760b..1a8e311 100644
wintoclient(Window w)
{
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 15f09e0e690328cb7bfd35b577435cba7b2e4859 Mon Sep 17 00:00:00 2001
From fdd7f85a71dd137e9e3ea313ce8c1588ba61d51a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 12 Jun 2023 15:17:51 +0200
Date: Mon, 24 Jun 2024 09:58:13 +0200
Subject: [PATCH 1/2] Banish patch - behaviour similiar to xbanish and
unclutter
@ -328,12 +328,12 @@ index e5efb6a..bb7760b 100644
showhide(Client *c)
{
--
2.19.1
2.45.2
From f1c11a763cb6943839c4e66c419bd84bd1b32459 Mon Sep 17 00:00:00 2001
From 2d9dd6a13f402f61e890cbbac4234f7c821bd1de Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Thu, 21 Sep 2023 11:01:56 +0200
Date: Mon, 24 Jun 2024 09:59:29 +0200
Subject: [PATCH 2/2] Adding cursorwarp patch on top of banish
---
@ -407,5 +407,5 @@ index bb7760b..1a8e311 100644
wintoclient(Window w)
{
--
2.19.1
2.45.2

View File

@ -0,0 +1,78 @@
From 3a3eb86264d4f6aef8f2c0942d8174bb509ec06f Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 1 Jul 2024 23:06:53 +0200
Subject: [PATCH 2/2] Adding cursorwarp patch on top of banish
---
dwm.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dwm.c b/dwm.c
index 0b554f9..9ed5e03 100644
--- a/dwm.c
+++ b/dwm.c
@@ -237,6 +237,7 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void warp(Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -866,6 +867,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
+ if (m->sel)
+ warp(m->sel)
}
void
@@ -891,6 +894,7 @@ focusstack(const Arg *arg)
if (c) {
focus(c);
restack(selmon);
+ warp(c)
}
}
@@ -1168,6 +1172,8 @@ manage(Window w, XWindowAttributes *wa)
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
+ if (c && c->mon == selmon && ISVISIBLE(c))
+ warp(c);
focus(NULL);
}
@@ -1937,6 +1943,8 @@ unmanage(Client *c, int destroyed)
focus(NULL);
updateclientlist();
arrange(m);
+ if (m->sel && m == selmon)
+ warp(m->sel);
}
void
@@ -2200,6 +2208,18 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+warp(Client *c)
+{
+ if (cursor_hidden) {
+ mouse_x = c->x + c->w/2;
+ mouse_y = c->y + c->h/2;
+ return;
+ }
+
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+}
+
Client *
wintoclient(Window w)
{
--
2.45.2

View File

@ -0,0 +1,411 @@
From 22abfa4fbe8795594dbc8b04b42a140eba021c4c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 09:58:13 +0200
Subject: [PATCH 1/2] Banish patch - behaviour similiar to xbanish and
unclutter
---
config.mk | 6 ++-
dwm.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 149 insertions(+), 7 deletions(-)
diff --git a/config.mk b/config.mk
index 8efca9a..220f4a9 100644
--- a/config.mk
+++ b/config.mk
@@ -14,6 +14,10 @@ X11LIB = /usr/X11R6/lib
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
+# Banish: dependency on libxi and libxfixes for mouse related features
+XINPUTLIBS = -lXi
+XFIXESLIBS = -lXfixes
+
# freetype
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
@@ -23,7 +27,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XINPUTLIBS} ${XFIXESLIBS}
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/dwm.c b/dwm.c
index f1d86b2..0b554f9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <time.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
@@ -39,6 +40,8 @@
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/XInput2.h>
#include <X11/Xft/Xft.h>
#include "drw.h"
@@ -49,6 +52,8 @@
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
+#define INTERSECTC(X,Y,W,H,Z) (MAX(0, MIN((X)+(W),(Z)->x+(Z)->w) - MAX((X),(Z)->x)) \
+ * MAX(0, MIN((Y)+(H),(Z)->y+(Z)->h) - MAX((Y),(Z)->y)))
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
@@ -169,12 +174,14 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static void genericevent(XEvent *e);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
+static void hidecursor(const Arg *arg);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
@@ -185,9 +192,11 @@ static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
+static unsigned long long now(void);
static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
+static Client *recttoclient(int x, int y, int w, int h, int include_floating);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
@@ -204,6 +213,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
+static void showcursor(const Arg *arg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
@@ -243,6 +253,14 @@ 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 cursor_hidden = 0;
+/* mouse_x and mouse_y are used to store the actual co-ordinates of the mouse cursor when
+ * hidden. These can be manipulated freely, e.g. when using the warp patch, to set a new
+ * cursor position for when the cursor is to be revealed again. */
+static int mouse_x = 0;
+static int mouse_y = 0;
+static int xi_opcode;
+static unsigned long long last_button_press = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
[ClientMessage] = clientmessage,
@@ -251,6 +269,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
[Expose] = expose,
+ [GenericEvent] = genericevent,
[FocusIn] = focusin,
[KeyPress] = keypress,
[MappingNotify] = mappingnotify,
@@ -431,7 +450,20 @@ buttonpress(XEvent *e)
selmon = m;
focus(NULL);
}
- if (ev->window == selmon->barwin) {
+
+ c = wintoclient(ev->window);
+
+ if (!c && cursor_hidden) {
+ c = recttoclient(mouse_x, mouse_y, 1, 1, 1);
+ showcursor(NULL);
+ }
+
+ if (c) {
+ focus(c);
+ restack(selmon);
+ XAllowEvents(dpy, ReplayPointer, CurrentTime);
+ click = ClkClientWin;
+ } else if (ev->window == selmon->barwin) {
i = x = 0;
do
x += TEXTW(tags[i]);
@@ -445,16 +477,14 @@ buttonpress(XEvent *e)
click = ClkStatusText;
else
click = ClkWinTitle;
- } else if ((c = wintoclient(ev->window))) {
- focus(c);
- restack(selmon);
- XAllowEvents(dpy, ReplayPointer, CurrentTime);
- click = ClkClientWin;
}
+
for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
+
+ last_button_press = now();
}
void
@@ -764,6 +794,9 @@ enternotify(XEvent *e)
Monitor *m;
XCrossingEvent *ev = &e->xcrossing;
+ if (cursor_hidden)
+ return;
+
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
return;
c = wintoclient(ev->window);
@@ -861,6 +894,36 @@ focusstack(const Arg *arg)
}
}
+void
+genericevent(XEvent *e)
+{
+ if (e->xcookie.extension != xi_opcode)
+ return;
+
+ if (!XGetEventData(dpy, &e->xcookie))
+ return;
+
+ switch (e->xcookie.evtype) {
+ case XI_RawMotion:
+ if (cursor_hidden)
+ showcursor(NULL);
+ break;
+ case XI_RawTouchBegin:
+ case XI_RawTouchEnd:
+ case XI_RawTouchUpdate:
+ if (!cursor_hidden)
+ hidecursor(NULL);
+ break;
+ case XI_RawKeyRelease:
+ if (now() - last_button_press > 2000 && !cursor_hidden) {
+ hidecursor(NULL);
+ }
+ break;
+ }
+
+ XFreeEventData(dpy, &e->xcookie);
+}
+
Atom
getatomprop(Client *c, Atom prop)
{
@@ -884,6 +947,12 @@ getrootptr(int *x, int *y)
unsigned int dui;
Window dummy;
+ if (cursor_hidden) {
+ *x = mouse_x;
+ *y = mouse_y;
+ return 1;
+ }
+
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
}
@@ -977,6 +1046,20 @@ grabkeys(void)
}
}
+void
+hidecursor(const Arg *arg)
+{
+ if (cursor_hidden)
+ return;
+
+ XFixesHideCursor(dpy, root);
+ if (getrootptr(&mouse_x, &mouse_y)) {
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mx + selmon->mw, selmon->my);
+ }
+
+ cursor_hidden = 1;
+}
+
void
incnmaster(const Arg *arg)
{
@@ -1209,6 +1292,13 @@ nexttiled(Client *c)
return c;
}
+unsigned long long
+now(void) {
+ struct timespec currentTime;
+ clock_gettime(CLOCK_REALTIME, &currentTime);
+ return currentTime.tv_sec * 1000LL + currentTime.tv_nsec / 1000000LL;
+}
+
void
pop(Client *c)
{
@@ -1261,6 +1351,23 @@ quit(const Arg *arg)
running = 0;
}
+Client *
+recttoclient(int x, int y, int w, int h, int include_floating)
+{
+ Client *c, *r = NULL;
+ int a, area = 1;
+
+ for (c = selmon->stack; c; c = c->snext) {
+ if (!ISVISIBLE(c) || (c->isfloating && !include_floating))
+ continue;
+ if ((a = INTERSECTC(x, y, w, h, c)) >= area) {
+ area = a;
+ r = c;
+ }
+ }
+ return r;
+}
+
Monitor *
recttomon(int x, int y, int w, int h)
{
@@ -1609,6 +1716,25 @@ setup(void)
|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
+
+ if (!XQueryExtension(dpy, "XInputExtension", &xi_opcode, &i, &i)) {
+ fprintf(stderr, "Warning: XInput is not available.");
+ }
+ /* Tell XInput to send us all RawMotion events. */
+ unsigned char mask_bytes[XIMaskLen(XI_LASTEVENT)];
+ memset(mask_bytes, 0, sizeof(mask_bytes));
+ XISetMask(mask_bytes, XI_RawMotion);
+ XISetMask(mask_bytes, XI_RawKeyRelease);
+ XISetMask(mask_bytes, XI_RawTouchBegin);
+ XISetMask(mask_bytes, XI_RawTouchEnd);
+ XISetMask(mask_bytes, XI_RawTouchUpdate);
+
+ XIEventMask mask;
+ mask.deviceid = XIAllMasterDevices;
+ mask.mask_len = sizeof(mask_bytes);
+ mask.mask = mask_bytes;
+ XISelectEvents(dpy, root, &mask, 1);
+
grabkeys();
focus(NULL);
}
@@ -1626,6 +1752,18 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
+void
+showcursor(const Arg *arg)
+{
+ if (!cursor_hidden)
+ return;
+
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, mouse_x, mouse_y);
+ XFixesShowCursor(dpy, root);
+
+ cursor_hidden = 0;
+}
+
void
showhide(Client *c)
{
--
2.45.2
From 3a3eb86264d4f6aef8f2c0942d8174bb509ec06f Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 1 Jul 2024 23:06:53 +0200
Subject: [PATCH 2/2] Adding cursorwarp patch on top of banish
---
dwm.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dwm.c b/dwm.c
index 0b554f9..9ed5e03 100644
--- a/dwm.c
+++ b/dwm.c
@@ -237,6 +237,7 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void warp(Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -866,6 +867,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
+ if (m->sel)
+ warp(m->sel)
}
void
@@ -891,6 +894,7 @@ focusstack(const Arg *arg)
if (c) {
focus(c);
restack(selmon);
+ warp(c)
}
}
@@ -1168,6 +1172,8 @@ manage(Window w, XWindowAttributes *wa)
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
+ if (c && c->mon == selmon && ISVISIBLE(c))
+ warp(c);
focus(NULL);
}
@@ -1937,6 +1943,8 @@ unmanage(Client *c, int destroyed)
focus(NULL);
updateclientlist();
arrange(m);
+ if (m->sel && m == selmon)
+ warp(m->sel);
}
void
@@ -2200,6 +2208,18 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+warp(Client *c)
+{
+ if (cursor_hidden) {
+ mouse_x = c->x + c->w/2;
+ mouse_y = c->y + c->h/2;
+ return;
+ }
+
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+}
+
Client *
wintoclient(Window w)
{
--
2.45.2

View File

@ -1,7 +1,7 @@
From 53e19fbad52e4cba1f9f2ed9f21ab26db37f4eef Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Sun, 19 Jul 2020 19:26:10 +0200
Subject: [PATCH] Bar Modules - splits the bar functionality into individual
From e4809db6a8422851916ca9e2eafc3b54acbe2735 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:11:26 +0200
Subject: [PATCH] Bar Modules - splits the bar functionality into individual
segments that can be re-arranged
---
@ -890,5 +890,5 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH] Bar Modules - splits the bar functionality into individual
segments that can be re-arranged
@ -893,5 +893,5 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From b7e853e0651aa4afd77785a5551b2f29a5d80f92 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 09:50:33 +0200
From 074e1dfb0a18569fdb2c58b9dbb3c4c83d078eb5 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:12:32 +0200
Subject: [PATCH 2/2] Adding awesomebar barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -176,5 +176,5 @@ index 5f9a3fe..de77a11 100644
+#include "bar_awesomebar.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From bef83ecfe66bb83a8420239f8c068cf60d2c3e0c Mon Sep 17 00:00:00 2001
From 1d4a880ab204ef8ad8e3539bf1cdc6f965f75229 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:07:02 +0100
Date: Mon, 24 Jun 2024 10:27:37 +0200
Subject: [PATCH 2/2] Adding awesomebar barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -176,5 +176,5 @@ index 5f9a3fe..de77a11 100644
+#include "bar_awesomebar.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From bef83ecfe66bb83a8420239f8c068cf60d2c3e0c Mon Sep 17 00:00:00 2001
From 1d4a880ab204ef8ad8e3539bf1cdc6f965f75229 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:07:02 +0100
Date: Mon, 24 Jun 2024 10:27:37 +0200
Subject: [PATCH 2/2] Adding awesomebar barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -1074,5 +1074,5 @@ index 5f9a3fe..de77a11 100644
+#include "bar_awesomebar.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From ac94fc8b1fa79ae02a67756a5bf972359987931b Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Thu, 13 Aug 2020 13:37:23 +0200
From 218faf77e8ba3f7f455374bc3557181b1f84e4d1 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:14:35 +0200
Subject: [PATCH 2/2] Adding bartabgroups barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -68,7 +68,7 @@ index 9173ba9..98ea0c2 100644
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
diff --git a/patch/bar_tabgroups.c b/patch/bar_tabgroups.c
new file mode 100644
index 0000000..116ddc7
index 0000000..cedf98b
--- /dev/null
+++ b/patch/bar_tabgroups.c
@@ -0,0 +1,233 @@
@ -217,7 +217,7 @@ index 0000000..116ddc7
+ }
+
+ if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
+ return;
+ return;
+
+ tgactive = 1;
+ num = tabw;
@ -347,5 +347,5 @@ index 5f9a3fe..a024a16 100644
+#include "bar_tabgroups.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From d8f276471e66eb7a4d9f5bcf23964f0e37be1db9 Mon Sep 17 00:00:00 2001
From 6d7c194480e01734dc4f7787a5344945c23ea79e Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:07:45 +0100
Date: Mon, 24 Jun 2024 10:29:47 +0200
Subject: [PATCH 2/2] Adding bartabgroups barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -68,7 +68,7 @@ index 86763d8..ba80bc9 100644
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
diff --git a/patch/bar_tabgroups.c b/patch/bar_tabgroups.c
new file mode 100644
index 0000000..116ddc7
index 0000000..d1b15f7
--- /dev/null
+++ b/patch/bar_tabgroups.c
@@ -0,0 +1,233 @@
@ -217,7 +217,7 @@ index 0000000..116ddc7
+ }
+
+ if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
+ return;
+ return;
+
+ tgactive = 1;
+ num = tabw;
@ -305,10 +305,9 @@ index 0000000..116ddc7
+ #endif // BARTAB_FLOATWEIGHT
+ }
+}
\ No newline at end of file
diff --git a/patch/bar_tabgroups.h b/patch/bar_tabgroups.h
new file mode 100644
index 0000000..15f6876
index 0000000..5940a5f
--- /dev/null
+++ b/patch/bar_tabgroups.h
@@ -0,0 +1,7 @@
@ -319,7 +318,6 @@ index 0000000..15f6876
+static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg);
+static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg);
+static void bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg);
\ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index d422f56..a1885ed 100644
--- a/patch/include.c
@ -347,5 +345,5 @@ index 5f9a3fe..a024a16 100644
+#include "bar_tabgroups.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From d8f276471e66eb7a4d9f5bcf23964f0e37be1db9 Mon Sep 17 00:00:00 2001
From 6d7c194480e01734dc4f7787a5344945c23ea79e Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:07:45 +0100
Date: Mon, 24 Jun 2024 10:29:47 +0200
Subject: [PATCH 2/2] Adding bartabgroups barmodules patch.
Note that this patch does not come with bound ClkWinTitle button click
@ -966,7 +966,7 @@ index 86763d8..ba80bc9 100644
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
diff --git a/patch/bar_tabgroups.c b/patch/bar_tabgroups.c
new file mode 100644
index 0000000..116ddc7
index 0000000..d1b15f7
--- /dev/null
+++ b/patch/bar_tabgroups.c
@@ -0,0 +1,233 @@
@ -1115,7 +1115,7 @@ index 0000000..116ddc7
+ }
+
+ if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
+ return;
+ return;
+
+ tgactive = 1;
+ num = tabw;
@ -1203,10 +1203,9 @@ index 0000000..116ddc7
+ #endif // BARTAB_FLOATWEIGHT
+ }
+}
\ No newline at end of file
diff --git a/patch/bar_tabgroups.h b/patch/bar_tabgroups.h
new file mode 100644
index 0000000..15f6876
index 0000000..5940a5f
--- /dev/null
+++ b/patch/bar_tabgroups.h
@@ -0,0 +1,7 @@
@ -1217,7 +1216,6 @@ index 0000000..15f6876
+static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg);
+static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg);
+static void bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg);
\ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index d422f56..a1885ed 100644
--- a/patch/include.c
@ -1245,5 +1243,5 @@ index 5f9a3fe..a024a16 100644
+#include "bar_tabgroups.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,15 +1,15 @@
From ee60db4461820fbc670338ed1cddbdc2ea5c0fd3 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 10:16:30 +0200
From 52e0578c880aa6b208769becdbd926fea6b622d7 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:16:45 +0200
Subject: [PATCH 2/2] Adding fancybar module
---
config.def.h | 2 +-
patch/bar_fancybar.c | 84 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.c | 82 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.h | 3 ++
patch/include.c | 3 +-
patch/include.h | 3 +-
5 files changed, 92 insertions(+), 3 deletions(-)
5 files changed, 90 insertions(+), 3 deletions(-)
create mode 100644 patch/bar_fancybar.c
create mode 100644 patch/bar_fancybar.h
@ -28,10 +28,10 @@ index 2534eac..40cb38c 100644
/* layout(s) */
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
new file mode 100644
index 0000000..810026d
index 0000000..7bcb079
--- /dev/null
+++ b/patch/bar_fancybar.c
@@ -0,0 +1,84 @@
@@ -0,0 +1,82 @@
+int
+width_fancybar(Bar *bar, BarWidthArg *a)
+{
@ -114,18 +114,15 @@ index 0000000..810026d
+{
+ return ClkWinTitle;
+}
+
+
diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h
new file mode 100644
index 0000000..c90d189
index 0000000..b23d930
--- /dev/null
+++ b/patch/bar_fancybar.h
@@ -0,0 +1,3 @@
+static int width_fancybar(Bar *bar, BarWidthArg *a);
+static int draw_fancybar(Bar *bar, BarDrawArg *a);
+static int click_fancybar(Bar *bar, Arg *arg, BarClickArg *a);
\ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index d422f56..2ab4594 100644
--- a/patch/include.c
@ -153,5 +150,5 @@ index 5f9a3fe..4eab55d 100644
+#include "bar_fancybar.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
From 01bd1d40399c4ee4b73216ab894d65bf29c01d93 Mon Sep 17 00:00:00 2001
From 3b4635d5fcc9f751cc09c855b6a7b4d04194275a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:08:23 +0100
Date: Mon, 24 Jun 2024 10:30:51 +0200
Subject: [PATCH 2/2] Adding fancybar module
---
config.def.h | 2 +-
patch/bar_fancybar.c | 84 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.c | 82 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.h | 3 ++
patch/include.c | 3 +-
patch/include.h | 3 +-
5 files changed, 92 insertions(+), 3 deletions(-)
5 files changed, 90 insertions(+), 3 deletions(-)
create mode 100644 patch/bar_fancybar.c
create mode 100644 patch/bar_fancybar.h
@ -28,10 +28,10 @@ index f870c41..59c1b42 100644
/* layout(s) */
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
new file mode 100644
index 0000000..810026d
index 0000000..7bcb079
--- /dev/null
+++ b/patch/bar_fancybar.c
@@ -0,0 +1,84 @@
@@ -0,0 +1,82 @@
+int
+width_fancybar(Bar *bar, BarWidthArg *a)
+{
@ -114,18 +114,15 @@ index 0000000..810026d
+{
+ return ClkWinTitle;
+}
+
+
diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h
new file mode 100644
index 0000000..c90d189
index 0000000..b23d930
--- /dev/null
+++ b/patch/bar_fancybar.h
@@ -0,0 +1,3 @@
+static int width_fancybar(Bar *bar, BarWidthArg *a);
+static int draw_fancybar(Bar *bar, BarDrawArg *a);
+static int click_fancybar(Bar *bar, Arg *arg, BarClickArg *a);
\ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index d422f56..2ab4594 100644
--- a/patch/include.c
@ -153,5 +150,5 @@ index 5f9a3fe..4eab55d 100644
+#include "bar_fancybar.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,21 +893,21 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 01bd1d40399c4ee4b73216ab894d65bf29c01d93 Mon Sep 17 00:00:00 2001
From 3b4635d5fcc9f751cc09c855b6a7b4d04194275a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:08:23 +0100
Date: Mon, 24 Jun 2024 10:30:51 +0200
Subject: [PATCH 2/2] Adding fancybar module
---
config.def.h | 2 +-
patch/bar_fancybar.c | 84 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.c | 82 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_fancybar.h | 3 ++
patch/include.c | 3 +-
patch/include.h | 3 +-
5 files changed, 92 insertions(+), 3 deletions(-)
5 files changed, 90 insertions(+), 3 deletions(-)
create mode 100644 patch/bar_fancybar.c
create mode 100644 patch/bar_fancybar.h
@ -926,10 +926,10 @@ index f870c41..59c1b42 100644
/* layout(s) */
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
new file mode 100644
index 0000000..810026d
index 0000000..7bcb079
--- /dev/null
+++ b/patch/bar_fancybar.c
@@ -0,0 +1,84 @@
@@ -0,0 +1,82 @@
+int
+width_fancybar(Bar *bar, BarWidthArg *a)
+{
@ -1012,18 +1012,15 @@ index 0000000..810026d
+{
+ return ClkWinTitle;
+}
+
+
diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h
new file mode 100644
index 0000000..c90d189
index 0000000..b23d930
--- /dev/null
+++ b/patch/bar_fancybar.h
@@ -0,0 +1,3 @@
+static int width_fancybar(Bar *bar, BarWidthArg *a);
+static int draw_fancybar(Bar *bar, BarDrawArg *a);
+static int click_fancybar(Bar *bar, Arg *arg, BarClickArg *a);
\ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index d422f56..2ab4594 100644
--- a/patch/include.c
@ -1051,5 +1048,5 @@ index 5f9a3fe..4eab55d 100644
+#include "bar_fancybar.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From de9e4c3cd933812c12b217c46f97b314584ed507 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 10:35:17 +0200
From 0a48663a9352d39d34a5762e201700189a49c13f Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:17:39 +0200
Subject: [PATCH 2/2] Adding powerline module
---
@ -133,7 +133,7 @@ index 4bcd5ad..4a42557 100644
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
diff --git a/dwm.c b/dwm.c
index 03dccfb..0e147de 100644
index 9173ba9..e243817 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1729,6 +1729,13 @@ setup(void)
@ -475,5 +475,5 @@ index 5f9a3fe..b313ca4 100644
+#include "bar_powerline_status.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From 97343b7b17a3bdc111768f026e8532b93143d409 Mon Sep 17 00:00:00 2001
From 34ab695c06feb31eb22d4efb4afd0cb10e2df798 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:08:58 +0100
Date: Mon, 24 Jun 2024 10:32:30 +0200
Subject: [PATCH 2/2] Adding powerline module
---
@ -475,5 +475,5 @@ index 5f9a3fe..b313ca4 100644
+#include "bar_powerline_status.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 97343b7b17a3bdc111768f026e8532b93143d409 Mon Sep 17 00:00:00 2001
From 34ab695c06feb31eb22d4efb4afd0cb10e2df798 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:08:58 +0100
Date: Mon, 24 Jun 2024 10:32:30 +0200
Subject: [PATCH 2/2] Adding powerline module
---
@ -1373,5 +1373,5 @@ index 5f9a3fe..b313ca4 100644
+#include "bar_powerline_status.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 6dad04f197cd5cf6867794728cbeaad0b0100aca Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 15:17:52 +0200
From e54364ed07c6f8546bd824da96e6ec3d636913c0 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:18:40 +0200
Subject: [PATCH 2/2] Adding status2d module
---
@ -28,7 +28,7 @@ index 2534eac..5acf4e5 100644
};
diff --git a/dwm.c b/dwm.c
index 03dccfb..3fe9faa 100644
index 9173ba9..f2339ca 100644
--- a/dwm.c
+++ b/dwm.c
@@ -289,7 +289,7 @@ static void zoom(const Arg *arg);
@ -342,5 +342,5 @@ index 5f9a3fe..2927238 100644
+#include "bar_status2d.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From 8592c59216ccdbaf3bfbc028130e116057517d0d Mon Sep 17 00:00:00 2001
From 0e8657c854a01ff5f6bc8e29f348a6a9217ecc4e Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:09:50 +0100
Date: Mon, 24 Jun 2024 10:33:10 +0200
Subject: [PATCH 2/2] Adding status2d module
---
@ -342,5 +342,5 @@ index 5f9a3fe..2927238 100644
+#include "bar_status2d.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 8592c59216ccdbaf3bfbc028130e116057517d0d Mon Sep 17 00:00:00 2001
From 0e8657c854a01ff5f6bc8e29f348a6a9217ecc4e Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:09:50 +0100
Date: Mon, 24 Jun 2024 10:33:10 +0200
Subject: [PATCH 2/2] Adding status2d module
---
@ -1240,5 +1240,5 @@ index 5f9a3fe..2927238 100644
+#include "bar_status2d.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From 15d27250cc3b1b34df8116052f5608a3be3388b8 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 15:17:52 +0200
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
From 87e97a96f7c85e0f34e370789e37bcc1dc577c96 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:20:18 +0200
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
module
---
@ -61,7 +61,7 @@ index 2534eac..40541cb 100644
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
diff --git a/dwm.c b/dwm.c
index 03dccfb..1e60958 100644
index 9173ba9..c290a68 100644
--- a/dwm.c
+++ b/dwm.c
@@ -289,7 +289,10 @@ static void zoom(const Arg *arg);
@ -95,7 +95,7 @@ index 03dccfb..1e60958 100644
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */
@@ -2169,8 +2173,19 @@ void
@@ -2182,8 +2186,19 @@ void
updatestatus(void)
{
Monitor *m;
@ -455,5 +455,5 @@ index 5f9a3fe..78f7520 100644
+#include "bar_statuscmd.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
From 69ba99292c4eac2ffa2eb1f1962f55ce463b35db Mon Sep 17 00:00:00 2001
From 6e1cb3b39aed9d17db6ef9f113c0ecea6f038942 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:10:28 +0100
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
Date: Mon, 24 Jun 2024 10:34:30 +0200
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
module
---
@ -455,5 +455,5 @@ index 5f9a3fe..78f7520 100644
+#include "bar_statuscmd.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,13 +893,13 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 69ba99292c4eac2ffa2eb1f1962f55ce463b35db Mon Sep 17 00:00:00 2001
From 6e1cb3b39aed9d17db6ef9f113c0ecea6f038942 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:10:28 +0100
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
Date: Mon, 24 Jun 2024 10:34:30 +0200
Subject: [PATCH 2/2] Adding status2d + statuscmd + dwmblocks + extrastatus
module
---
@ -1353,5 +1353,5 @@ index 5f9a3fe..78f7520 100644
+#include "bar_statuscmd.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 54297429dcf490511076ebc738c9688e113c7731 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 11:48:07 +0200
From cc71203d4552f31828e2f6c07d1dc32502e7fff9 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:21:03 +0200
Subject: [PATCH 2/2] Adding statusbutton module
---
@ -47,7 +47,7 @@ index 2534eac..b70c552 100644
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
diff --git a/dwm.c b/dwm.c
index 03dccfb..048221b 100644
index 9173ba9..88e7197 100644
--- a/dwm.c
+++ b/dwm.c
@@ -65,7 +65,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
@ -123,5 +123,5 @@ index 5f9a3fe..c2a1127 100644
+#include "bar_statusbutton.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From 941d14787a5f49e5fe1be516a2b30858110ec35d Mon Sep 17 00:00:00 2001
From 81c10e4c2ac7fb5616bf33381eb7501be99c60e3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:11:09 +0100
Date: Mon, 24 Jun 2024 10:35:14 +0200
Subject: [PATCH 2/2] Adding statusbutton module
---
@ -123,5 +123,5 @@ index 5f9a3fe..c2a1127 100644
+#include "bar_statusbutton.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 941d14787a5f49e5fe1be516a2b30858110ec35d Mon Sep 17 00:00:00 2001
From 81c10e4c2ac7fb5616bf33381eb7501be99c60e3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:11:09 +0100
Date: Mon, 24 Jun 2024 10:35:14 +0200
Subject: [PATCH 2/2] Adding statusbutton module
---
@ -1021,5 +1021,5 @@ index 5f9a3fe..c2a1127 100644
+#include "bar_statusbutton.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,16 +1,16 @@
From 6c4fcf6c03689c39aba7ab2e7c28ee81145e3f3d Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 11:19:12 +0200
From 4565443bb8450bb697811807b034f4b0e88705e3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:22:25 +0200
Subject: [PATCH 2/2] Adding systray module
---
config.def.h | 3 +
dwm.c | 131 ++++++++++++++++++++++++++----
patch/bar_systray.c | 190 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_systray.h | 40 ++++++++++
patch/bar_systray.h | 39 +++++++++
patch/include.c | 3 +-
patch/include.h | 3 +-
6 files changed, 353 insertions(+), 17 deletions(-)
6 files changed, 352 insertions(+), 17 deletions(-)
create mode 100644 patch/bar_systray.c
create mode 100644 patch/bar_systray.h
@ -36,7 +36,7 @@ index 2534eac..d17b65c 100644
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
};
diff --git a/dwm.c b/dwm.c
index 03dccfb..39fbfdb 100644
index 9173ba9..1ded14d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -63,6 +63,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@ -486,10 +486,10 @@ index 0000000..3ae2e56
+}
diff --git a/patch/bar_systray.h b/patch/bar_systray.h
new file mode 100644
index 0000000..5123a73
index 0000000..27edc8e
--- /dev/null
+++ b/patch/bar_systray.h
@@ -0,0 +1,40 @@
@@ -0,0 +1,39 @@
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+
@ -529,7 +529,6 @@ index 0000000..5123a73
+static void updatesystrayicongeom(Client *i, int w, int h);
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
+static Client *wintosystrayicon(Window w);
+
diff --git a/patch/include.c b/patch/include.c
index d422f56..c82b392 100644
--- a/patch/include.c
@ -557,5 +556,5 @@ index 5f9a3fe..c01916a 100644
+#include "bar_systray.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,17 @@
From a44a11168d6823a5b725242dfb5480b5be2f4b91 Mon Sep 17 00:00:00 2001
From 7717eca68a2f135d64b5a4b9e4ac7cd243e123c3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:11:51 +0100
Date: Mon, 24 Jun 2024 10:38:30 +0200
Subject: [PATCH 2/2] Adding systray module
---
config.def.h | 3 +
dwm.c | 131 ++++++++++++++++++++++++++----
patch/bar_status.c | 2 -
patch/bar_systray.c | 190 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_systray.h | 40 ++++++++++
patch/bar_systray.h | 39 +++++++++
patch/include.c | 3 +-
patch/include.h | 3 +-
6 files changed, 353 insertions(+), 17 deletions(-)
7 files changed, 352 insertions(+), 19 deletions(-)
create mode 100644 patch/bar_systray.c
create mode 100644 patch/bar_systray.h
@ -288,6 +289,25 @@ index 86763d8..6875b06 100644
}
}
diff --git a/patch/bar_status.c b/patch/bar_status.c
index 7d27282..84301d1 100644
--- a/patch/bar_status.c
+++ b/patch/bar_status.c
@@ -4,14 +4,12 @@ width_status(Bar *bar, BarWidthArg *a)
return TEXTW(stext);
}
-
int
draw_status(Bar *bar, BarDrawArg *a)
{
return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0);
}
-
int
click_status(Bar *bar, Arg *arg, BarClickArg *a)
{
diff --git a/patch/bar_systray.c b/patch/bar_systray.c
new file mode 100644
index 0000000..3ae2e56
@ -486,10 +506,10 @@ index 0000000..3ae2e56
+}
diff --git a/patch/bar_systray.h b/patch/bar_systray.h
new file mode 100644
index 0000000..5123a73
index 0000000..27edc8e
--- /dev/null
+++ b/patch/bar_systray.h
@@ -0,0 +1,40 @@
@@ -0,0 +1,39 @@
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+
@ -529,7 +549,6 @@ index 0000000..5123a73
+static void updatesystrayicongeom(Client *i, int w, int h);
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
+static Client *wintosystrayicon(Window w);
+
diff --git a/patch/include.c b/patch/include.c
index d422f56..c82b392 100644
--- a/patch/include.c
@ -557,5 +576,5 @@ index 5f9a3fe..c01916a 100644
+#include "bar_systray.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,22 +893,23 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From a44a11168d6823a5b725242dfb5480b5be2f4b91 Mon Sep 17 00:00:00 2001
From 7717eca68a2f135d64b5a4b9e4ac7cd243e123c3 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:11:51 +0100
Date: Mon, 24 Jun 2024 10:38:30 +0200
Subject: [PATCH 2/2] Adding systray module
---
config.def.h | 3 +
dwm.c | 131 ++++++++++++++++++++++++++----
patch/bar_status.c | 2 -
patch/bar_systray.c | 190 ++++++++++++++++++++++++++++++++++++++++++++
patch/bar_systray.h | 40 ++++++++++
patch/bar_systray.h | 39 +++++++++
patch/include.c | 3 +-
patch/include.h | 3 +-
6 files changed, 353 insertions(+), 17 deletions(-)
7 files changed, 352 insertions(+), 19 deletions(-)
create mode 100644 patch/bar_systray.c
create mode 100644 patch/bar_systray.h
@ -1186,6 +1187,25 @@ index 86763d8..6875b06 100644
}
}
diff --git a/patch/bar_status.c b/patch/bar_status.c
index 7d27282..84301d1 100644
--- a/patch/bar_status.c
+++ b/patch/bar_status.c
@@ -4,14 +4,12 @@ width_status(Bar *bar, BarWidthArg *a)
return TEXTW(stext);
}
-
int
draw_status(Bar *bar, BarDrawArg *a)
{
return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0);
}
-
int
click_status(Bar *bar, Arg *arg, BarClickArg *a)
{
diff --git a/patch/bar_systray.c b/patch/bar_systray.c
new file mode 100644
index 0000000..3ae2e56
@ -1384,10 +1404,10 @@ index 0000000..3ae2e56
+}
diff --git a/patch/bar_systray.h b/patch/bar_systray.h
new file mode 100644
index 0000000..5123a73
index 0000000..27edc8e
--- /dev/null
+++ b/patch/bar_systray.h
@@ -0,0 +1,40 @@
@@ -0,0 +1,39 @@
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+
@ -1427,7 +1447,6 @@ index 0000000..5123a73
+static void updatesystrayicongeom(Client *i, int w, int h);
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
+static Client *wintosystrayicon(Window w);
+
diff --git a/patch/include.c b/patch/include.c
index d422f56..c82b392 100644
--- a/patch/include.c
@ -1455,5 +1474,5 @@ index 5f9a3fe..c01916a 100644
+#include "bar_systray.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From fbb66e4a6d703247979b8c2a6718aa8f0265804f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 20 Jul 2020 15:57:24 +0200
From c6cd506ad4f9d53bbc08b645ad811091033bf82b Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:23:20 +0200
Subject: [PATCH 2/2] Adding taggrid module
---
@ -256,5 +256,5 @@ index 5f9a3fe..98ac046 100644
+#include "bar_taggrid.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From 3b3064354ad90f18beb933b3d2b5ecf892201633 Mon Sep 17 00:00:00 2001
From 4b372f75930071d4947c17f49a2967329435effc Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:12:28 +0100
Date: Mon, 24 Jun 2024 10:45:39 +0200
Subject: [PATCH 2/2] Adding taggrid module
---
@ -256,5 +256,5 @@ index 5f9a3fe..98ac046 100644
+#include "bar_taggrid.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,12 +893,12 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 3b3064354ad90f18beb933b3d2b5ecf892201633 Mon Sep 17 00:00:00 2001
From 4b372f75930071d4947c17f49a2967329435effc Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:12:28 +0100
Date: Mon, 24 Jun 2024 10:45:39 +0200
Subject: [PATCH 2/2] Adding taggrid module
---
@ -1154,5 +1154,5 @@ index 5f9a3fe..98ac046 100644
+#include "bar_taggrid.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From f1a4e004be933b186d8466fd483e46f99dbd5f5a Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Thu, 13 Aug 2020 14:56:13 +0200
Subject: [PATCH 2/2] Adding wintitleactions patch
From 7fda28af251751b902f0768e1475773f94a4f0d7 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:25:06 +0200
Subject: [PATCH 2/2] Adding wintitleactions module
---
config.def.h | 4 ++
@ -262,5 +262,5 @@ index 5f9a3fe..be075b5 100644
+#include "bar_wintitleactions.h"
\ No newline at end of file
--
2.19.1
2.45.2

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
From 54674a344665e893a72a81319b7caf9226a2180f Mon Sep 17 00:00:00 2001
From 8f37d590e96760faa74a34bce4cf44a34296e8db Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:13:41 +0100
Subject: [PATCH 2/2] Adding wintitleactions patch
Date: Mon, 24 Jun 2024 10:46:50 +0200
Subject: [PATCH 2/2] Adding wintitleactions module
---
config.def.h | 4 ++
@ -262,5 +262,5 @@ index 5f9a3fe..be075b5 100644
+#include "bar_wintitleactions.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 2433e0499e4607d39a3f511449f9466886055914 Mon Sep 17 00:00:00 2001
From dc164866ceb8a8e76d6e84a26979052b581bea93 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:06:10 +0100
Date: Mon, 24 Jun 2024 10:26:44 +0200
Subject: [PATCH 1/2] Bar Modules - splits the bar functionality into
individual segments that can be re-arranged
@ -893,13 +893,13 @@ index 0000000..5f9a3fe
+#include "bar_wintitle.h"
\ No newline at end of file
--
2.19.1
2.45.2
From 54674a344665e893a72a81319b7caf9226a2180f Mon Sep 17 00:00:00 2001
From 8f37d590e96760faa74a34bce4cf44a34296e8db Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:13:41 +0100
Subject: [PATCH 2/2] Adding wintitleactions patch
Date: Mon, 24 Jun 2024 10:46:50 +0200
Subject: [PATCH 2/2] Adding wintitleactions module
---
config.def.h | 4 ++
@ -1160,5 +1160,5 @@ index 5f9a3fe..be075b5 100644
+#include "bar_wintitleactions.h"
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From ad9b8cbbc006815f51c8f279359629d6b4435f23 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 31 May 2021 09:51:33 +0200
From 01d300873bd97a6bac1aa116ce0e8db2102c0fd2 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:26:07 +0200
Subject: [PATCH] barpadding: multi-monitor fix
Ref.
@ -113,5 +113,5 @@ index 4465af1..60a3632 100644
void
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From a3e3bd001c4b9b4d5bc6b26ed0cef6f2ec78a205 Mon Sep 17 00:00:00 2001
From 7e3b289196d6208ed8f1d771912fd878ef2d9a0a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 14:49:22 +0100
Date: Mon, 24 Jun 2024 10:47:30 +0200
Subject: [PATCH] barpadding: multi-monitor fix
Ref.
@ -113,5 +113,5 @@ index a96f33c..5728f92 100644
void
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From b43967c344032b6bd2bf0e495641ac22ce8c7294 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 12:29:08 +0200
Subject: [PATCH] Adding 6.2 center patch with multi-monitor fix and
From 556d77518363529bb89f1e3e435364ee635ed9c4 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 10:48:36 +0200
Subject: [PATCH] Adding 6.2 center patch with multi-monitor fix and
auto-centering of floating popup windows
Refer to https://dwm.suckless.org/patches/center/
@ -88,5 +88,5 @@ index 4465af1..ab33757 100644
void
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 687f8c8ff590302462e629f8313b8fc6371e09ca Mon Sep 17 00:00:00 2001
From d29f1a2202d46792d28f6e3610a679a2a7654144 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:17:58 +0100
Date: Mon, 24 Jun 2024 10:48:08 +0200
Subject: [PATCH] Adding 6.3 center patch with multi-monitor fix and
auto-centering of floating popup windows
@ -88,5 +88,5 @@ index a96f33c..b7b97e3 100644
void
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From 5c86668af07d66a6f5e09efee7e6bc16dcd85899 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Wed, 27 Jan 2021 14:55:14 +0100
Subject: [PATCH] Center clients within their allocated tile based on size
From 48b99ccded0f23bd115cecb8e1fe34fcdb51eaf5 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 16:03:02 +0200
Subject: [PATCH] Center clients within their allocated tile based on size
hints
---
@ -75,5 +75,5 @@ index 4465af1..499ae91 100644
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From b38b2f665b587add976cd9572ad0bfb748f1b143 Mon Sep 17 00:00:00 2001
From 08628b009cf2dce509b2d4b3954661fdc3f0e741 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:19:17 +0100
Subject: [PATCH] Center clients within their allocated tile based on size
Date: Mon, 24 Jun 2024 16:03:31 +0200
Subject: [PATCH] Center clients within their allocated tile based on size
hints
---
@ -75,5 +75,5 @@ index a96f33c..bc7c7ef 100644
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
--
2.19.1
2.45.2

View File

@ -0,0 +1,71 @@
From 9566bc1d2766125b8cfd6a7ad2874f0e4d3c31c6 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 24 Jun 2024 16:03:31 +0200
Subject: [PATCH] Center clients within their allocated tile based on size
hints
---
dwm.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/dwm.c b/dwm.c
index f1d86b2..bed044b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -191,6 +191,7 @@ static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
+static void resizeclientpad(Client *c, int x, int y, int w, int h, int xpad, int ypad);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
@@ -1276,21 +1277,41 @@ recttomon(int x, int y, int w, int h)
}
void
-resize(Client *c, int x, int y, int w, int h, int interact)
+resize(Client *c, int tx, int ty, int tw, int th, int interact)
{
- if (applysizehints(c, &x, &y, &w, &h, interact))
- resizeclient(c, x, y, w, h);
+ int wh = tw, hh = th;
+ if (applysizehints(c, &tx, &ty, &wh, &hh, interact))
+ resizeclientpad(c, tx, ty, wh, hh, tw, th);
}
+/* This wrapper is just for compatibility with other patches that may call resizeclient */
void
resizeclient(Client *c, int x, int y, int w, int h)
{
- XWindowChanges wc;
+ resizeclientpad(c, x, y, w, h, w, h);
+}
+/* This is essentially the resizeclient function renamed with two
+ * additional parameters, tw and th (for tile width and height). */
+void
+resizeclientpad(Client *c, int x, int y, int w, int h, int tw, int th)
+{
+ XWindowChanges wc;
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;
+ if (!c->isfloating) {
+ if (w != tw) {
+ wc.x += (tw - w) / 2;
+ c->w = tw;
+ }
+ if (h != th) {
+ wc.y += (th - h) / 2;
+ c->h = th;
+ }
+ }
+
wc.border_width = c->bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
--
2.45.2

View File

@ -1,10 +1,9 @@
From 1f9992ae1a745a86294a555051ea17ba4ef5ce5f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 6 Apr 2020 12:04:55 +0200
From 4310ecf601e26f84966d9a1584a023ae52fa4cc8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:37:23 +0200
Subject: [PATCH] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -113,5 +112,5 @@ index 4465af1..5592c57 100644
}
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 112abfec73e12282e4b0288f2e7739000ad135b6 Mon Sep 17 00:00:00 2001
From f3fbb79fd00a07443b300174fae59fe4c523d8f8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:21:06 +0100
Subject: [PATCH] Adding cfacts patch which provides the ability to assign
Date: Wed, 26 Jun 2024 09:38:02 +0200
Subject: [PATCH] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,5 +114,5 @@ index a96f33c..bcb155d 100644
}
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 484919dbd6095feb5a51cefd531c3c6bb3c92108 Mon Sep 17 00:00:00 2001
From b24a5d1f65b7dcbf26750414d19a0391a4e2b22a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:02:47 +0200
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,5 +114,5 @@ index e5efb6a..89d4f9a 100644
}
--
2.19.1
2.45.2

118
dwm/dwm-cfacts-6.5.diff Normal file
View File

@ -0,0 +1,118 @@
From 24baa1d2be62dac15e5f6b573112b7a4fb256ced Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9efa774..d6c2677 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,6 +71,9 @@ static const Key keys[] = {
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
+ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index f1d86b2..43108c6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -87,6 +87,7 @@ typedef struct Client Client;
struct Client {
char name[256];
float mina, maxa;
+ float cfact;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
@@ -201,6 +202,7 @@ static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
+static void setcfact(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
@@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa)
c->w = c->oldw = wa->width;
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
+ c->cfact = 1.0;
updatetitle(c);
if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
@@ -1521,6 +1524,24 @@ setlayout(const Arg *arg)
drawbar(selmon);
}
+void
+setcfact(const Arg *arg) {
+ float f;
+ Client *c;
+
+ c = selmon->sel;
+
+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f + c->cfact;
+ if(arg->f == 0.0)
+ f = 1.0;
+ else if(f < 0.25 || f > 4.0)
+ return;
+ c->cfact = f;
+ arrange(selmon);
+}
+
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
@@ -1688,9 +1709,15 @@ void
tile(Monitor *m)
{
unsigned int i, n, h, mw, my, ty;
+ float mfacts = 0, sfacts = 0;
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 < m->nmaster)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+ }
if (n == 0)
return;
@@ -1700,15 +1727,17 @@ tile(Monitor *m)
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);
+ h = (m->wh - my) * (c->cfact / mfacts);
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);
+ mfacts -= c->cfact;
} else {
- h = (m->wh - ty) / (n - i);
+ h = (m->wh - ty) * (c->cfact / sfacts);
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);
+ sfacts -= c->cfact;
}
}
--
2.45.2

View File

@ -1,6 +1,6 @@
From ee8e7b96d6f36f244d68753c2e795a29a7118913 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 6 Apr 2020 12:16:26 +0200
From 307943dac6555b7251697e7b0f0eb2af2e14d2c7 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:40:24 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
@ -148,5 +148,5 @@ index 5592c57..2d591e3 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 1f9992ae1a745a86294a555051ea17ba4ef5ce5f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 6 Apr 2020 12:04:55 +0200
From 4310ecf601e26f84966d9a1584a023ae52fa4cc8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:37:23 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -113,12 +112,12 @@ index 4465af1..5592c57 100644
}
--
2.19.1
2.45.2
From ee8e7b96d6f36f244d68753c2e795a29a7118913 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 6 Apr 2020 12:16:26 +0200
From 307943dac6555b7251697e7b0f0eb2af2e14d2c7 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:40:24 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
@ -266,5 +265,5 @@ index 5592c57..2d591e3 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -1,7 +1,7 @@
From 39647ff8b155bdff072e32d04ca4e1c5e27873d5 Mon Sep 17 00:00:00 2001
From 4464ebaba7848d4ecf642a2f6b02334345e8260b Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:22:21 +0100
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
Date: Wed, 26 Jun 2024 09:40:40 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
---
@ -148,5 +148,5 @@ index bcb155d..54f7320 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 112abfec73e12282e4b0288f2e7739000ad135b6 Mon Sep 17 00:00:00 2001
From f3fbb79fd00a07443b300174fae59fe4c523d8f8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:21:06 +0100
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
Date: Wed, 26 Jun 2024 09:38:02 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,13 +114,13 @@ index a96f33c..bcb155d 100644
}
--
2.19.1
2.45.2
From 39647ff8b155bdff072e32d04ca4e1c5e27873d5 Mon Sep 17 00:00:00 2001
From 4464ebaba7848d4ecf642a2f6b02334345e8260b Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:22:21 +0100
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
Date: Wed, 26 Jun 2024 09:40:40 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
---
@ -268,5 +267,5 @@ index bcb155d..54f7320 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From ec8a0bef32561a44fa369cbc3fc1b7fbe10c07c9 Mon Sep 17 00:00:00 2001
From 47de47f77eab8d09ffc34fcb4c9f19b9bcc87f4b Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:04:10 +0200
Date: Wed, 26 Jun 2024 09:40:56 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
@ -148,5 +148,5 @@ index 89d4f9a..a965c4f 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 484919dbd6095feb5a51cefd531c3c6bb3c92108 Mon Sep 17 00:00:00 2001
From b24a5d1f65b7dcbf26750414d19a0391a4e2b22a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:02:47 +0200
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,12 +114,12 @@ index e5efb6a..89d4f9a 100644
}
--
2.19.1
2.45.2
From ec8a0bef32561a44fa369cbc3fc1b7fbe10c07c9 Mon Sep 17 00:00:00 2001
From 47de47f77eab8d09ffc34fcb4c9f19b9bcc87f4b Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:04:10 +0200
Date: Wed, 26 Jun 2024 09:40:56 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
@ -268,5 +267,5 @@ index 89d4f9a..a965c4f 100644
arrange(selmon);
}
--
2.19.1
2.45.2

View File

@ -0,0 +1,152 @@
From c3dcd243baee0e0c068bd061333ed7162ffd0054 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:41:35 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
---
config.def.h | 1 +
dwm.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 89 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index d6c2677..a060f06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -111,6 +111,7 @@ static const Button buttons[] = {
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkClientWin, MODKEY|ShiftMask, Button3, dragcfact, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
diff --git a/dwm.c b/dwm.c
index 43108c6..2bbbc19 100644
--- a/dwm.c
+++ b/dwm.c
@@ -162,6 +162,7 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
+static void dragcfact(const Arg *arg);
static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
@@ -697,6 +698,81 @@ dirtomon(int dir)
return m;
}
+void
+dragcfact(const Arg *arg)
+{
+ int prev_x, prev_y, dist_x, dist_y;
+ float fact;
+ Client *c;
+ XEvent ev;
+ Time lasttime = 0;
+
+ if (!(c = selmon->sel))
+ return;
+ if (c->isfloating) {
+ resizemouse(arg);
+ return;
+ }
+ #if !FAKEFULLSCREEN_PATCH
+ #if FAKEFULLSCREEN_CLIENT_PATCH
+ if (c->isfullscreen && !c->fakefullscreen) /* no support resizing fullscreen windows by mouse */
+ return;
+ #else
+ if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
+ return;
+ #endif // FAKEFULLSCREEN_CLIENT_PATCH
+ #endif // !FAKEFULLSCREEN_PATCH
+ restack(selmon);
+
+ if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
+ return;
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+
+ prev_x = prev_y = -999999;
+
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch(ev.type) {
+ case ConfigureRequest:
+ case Expose:
+ case MapRequest:
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 60))
+ continue;
+ lasttime = ev.xmotion.time;
+ if (prev_x == -999999) {
+ prev_x = ev.xmotion.x_root;
+ prev_y = ev.xmotion.y_root;
+ }
+
+ dist_x = ev.xmotion.x - prev_x;
+ dist_y = ev.xmotion.y - prev_y;
+
+ if (abs(dist_x) > abs(dist_y)) {
+ fact = (float) 4.0 * dist_x / c->mon->ww;
+ } else {
+ fact = (float) -4.0 * dist_y / c->mon->wh;
+ }
+
+ if (fact)
+ setcfact(&((Arg) { .f = fact }));
+
+ prev_x = ev.xmotion.x;
+ prev_y = ev.xmotion.y;
+ break;
+ }
+ } while (ev.type != ButtonRelease);
+
+
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+
+ XUngrabPointer(dpy, CurrentTime);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
void
drawbar(Monitor *m)
{
@@ -1525,19 +1601,25 @@ setlayout(const Arg *arg)
}
void
-setcfact(const Arg *arg) {
+setcfact(const Arg *arg)
+{
float f;
Client *c;
c = selmon->sel;
- if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ if (!arg || !c || !selmon->lt[selmon->sellt]->arrange)
return;
- f = arg->f + c->cfact;
- if(arg->f == 0.0)
+ if (!arg->f)
f = 1.0;
- else if(f < 0.25 || f > 4.0)
- return;
+ else if (arg->f > 4.0) // set fact absolutely
+ f = arg->f - 4.0;
+ else
+ f = arg->f + c->cfact;
+ if (f < 0.25)
+ f = 0.25;
+ else if (f > 4.0)
+ f = 4.0;
c->cfact = f;
arrange(selmon);
}
--
2.45.2

View File

@ -0,0 +1,271 @@
From 24baa1d2be62dac15e5f6b573112b7a4fb256ced Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9efa774..d6c2677 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,6 +71,9 @@ static const Key keys[] = {
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
+ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index f1d86b2..43108c6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -87,6 +87,7 @@ typedef struct Client Client;
struct Client {
char name[256];
float mina, maxa;
+ float cfact;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
@@ -201,6 +202,7 @@ static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
+static void setcfact(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
@@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa)
c->w = c->oldw = wa->width;
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
+ c->cfact = 1.0;
updatetitle(c);
if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
@@ -1521,6 +1524,24 @@ setlayout(const Arg *arg)
drawbar(selmon);
}
+void
+setcfact(const Arg *arg) {
+ float f;
+ Client *c;
+
+ c = selmon->sel;
+
+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f + c->cfact;
+ if(arg->f == 0.0)
+ f = 1.0;
+ else if(f < 0.25 || f > 4.0)
+ return;
+ c->cfact = f;
+ arrange(selmon);
+}
+
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
@@ -1688,9 +1709,15 @@ void
tile(Monitor *m)
{
unsigned int i, n, h, mw, my, ty;
+ float mfacts = 0, sfacts = 0;
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 < m->nmaster)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+ }
if (n == 0)
return;
@@ -1700,15 +1727,17 @@ tile(Monitor *m)
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);
+ h = (m->wh - my) * (c->cfact / mfacts);
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);
+ mfacts -= c->cfact;
} else {
- h = (m->wh - ty) / (n - i);
+ h = (m->wh - ty) * (c->cfact / sfacts);
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);
+ sfacts -= c->cfact;
}
}
--
2.45.2
From c3dcd243baee0e0c068bd061333ed7162ffd0054 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:41:35 +0200
Subject: [PATCH 2/2] The dragcfact patch allow you resize clients' size (i.e.
modify cfact) by holding modkey + shift + right-click and dragging the mouse.
---
config.def.h | 1 +
dwm.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 89 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index d6c2677..a060f06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -111,6 +111,7 @@ static const Button buttons[] = {
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkClientWin, MODKEY|ShiftMask, Button3, dragcfact, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
diff --git a/dwm.c b/dwm.c
index 43108c6..2bbbc19 100644
--- a/dwm.c
+++ b/dwm.c
@@ -162,6 +162,7 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
+static void dragcfact(const Arg *arg);
static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
@@ -697,6 +698,81 @@ dirtomon(int dir)
return m;
}
+void
+dragcfact(const Arg *arg)
+{
+ int prev_x, prev_y, dist_x, dist_y;
+ float fact;
+ Client *c;
+ XEvent ev;
+ Time lasttime = 0;
+
+ if (!(c = selmon->sel))
+ return;
+ if (c->isfloating) {
+ resizemouse(arg);
+ return;
+ }
+ #if !FAKEFULLSCREEN_PATCH
+ #if FAKEFULLSCREEN_CLIENT_PATCH
+ if (c->isfullscreen && !c->fakefullscreen) /* no support resizing fullscreen windows by mouse */
+ return;
+ #else
+ if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
+ return;
+ #endif // FAKEFULLSCREEN_CLIENT_PATCH
+ #endif // !FAKEFULLSCREEN_PATCH
+ restack(selmon);
+
+ if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
+ return;
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+
+ prev_x = prev_y = -999999;
+
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch(ev.type) {
+ case ConfigureRequest:
+ case Expose:
+ case MapRequest:
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 60))
+ continue;
+ lasttime = ev.xmotion.time;
+ if (prev_x == -999999) {
+ prev_x = ev.xmotion.x_root;
+ prev_y = ev.xmotion.y_root;
+ }
+
+ dist_x = ev.xmotion.x - prev_x;
+ dist_y = ev.xmotion.y - prev_y;
+
+ if (abs(dist_x) > abs(dist_y)) {
+ fact = (float) 4.0 * dist_x / c->mon->ww;
+ } else {
+ fact = (float) -4.0 * dist_y / c->mon->wh;
+ }
+
+ if (fact)
+ setcfact(&((Arg) { .f = fact }));
+
+ prev_x = ev.xmotion.x;
+ prev_y = ev.xmotion.y;
+ break;
+ }
+ } while (ev.type != ButtonRelease);
+
+
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
+
+ XUngrabPointer(dpy, CurrentTime);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
void
drawbar(Monitor *m)
{
@@ -1525,19 +1601,25 @@ setlayout(const Arg *arg)
}
void
-setcfact(const Arg *arg) {
+setcfact(const Arg *arg)
+{
float f;
Client *c;
c = selmon->sel;
- if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ if (!arg || !c || !selmon->lt[selmon->sellt]->arrange)
return;
- f = arg->f + c->cfact;
- if(arg->f == 0.0)
+ if (!arg->f)
f = 1.0;
- else if(f < 0.25 || f > 4.0)
- return;
+ else if (arg->f > 4.0) // set fact absolutely
+ f = arg->f - 4.0;
+ else
+ f = arg->f + c->cfact;
+ if (f < 0.25)
+ f = 0.25;
+ else if (f > 4.0)
+ f = 4.0;
c->cfact = f;
arrange(selmon);
}
--
2.45.2

View File

@ -1,6 +1,6 @@
From a949d129b7e51bcda7372cfc304ad081d66445d6 Mon Sep 17 00:00:00 2001
From 9eaea08f3a66b2a8e787f562a0656cdc846d5925 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 12 Sep 2022 12:47:08 +0200
Date: Wed, 26 Jun 2024 09:55:45 +0200
Subject: [PATCH 2/2] Adding dragfact patch (combines dragmfact and dragcfact)
---
@ -157,5 +157,5 @@ index bcb155d..30e64ac 100644
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 112abfec73e12282e4b0288f2e7739000ad135b6 Mon Sep 17 00:00:00 2001
From f3fbb79fd00a07443b300174fae59fe4c523d8f8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:21:06 +0100
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
Date: Wed, 26 Jun 2024 09:38:02 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,12 +114,12 @@ index a96f33c..bcb155d 100644
}
--
2.19.1
2.45.2
From a949d129b7e51bcda7372cfc304ad081d66445d6 Mon Sep 17 00:00:00 2001
From 9eaea08f3a66b2a8e787f562a0656cdc846d5925 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 12 Sep 2022 12:47:08 +0200
Date: Wed, 26 Jun 2024 09:55:45 +0200
Subject: [PATCH 2/2] Adding dragfact patch (combines dragmfact and dragcfact)
---
@ -277,5 +276,5 @@ index bcb155d..30e64ac 100644
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
--
2.19.1
2.45.2

View File

@ -0,0 +1,161 @@
From f5abc9603da0acfdcd77a5470488eee33dab6b6c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:56:32 +0200
Subject: [PATCH 2/2] Adding dragfact patch (combines dragmfact and dragcfact)
---
config.def.h | 3 +-
dwm.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index d6c2677..bfe1166 100644
--- a/config.def.h
+++ b/config.def.h
@@ -110,7 +110,8 @@ static const Button buttons[] = {
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
- { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkClientWin, MODKEY, Button3, resizeorfacts, {0} },
+ { ClkClientWin, MODKEY|ShiftMask, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
diff --git a/dwm.c b/dwm.c
index 43108c6..15a0a3d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -58,7 +58,7 @@
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
-enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+enum { CurNormal, CurResize, CurMove, CurDragFact, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
@@ -162,6 +162,7 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
+static void dragfact(const Arg *arg);
static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
@@ -193,6 +194,7 @@ static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
+static void resizeorfacts(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
@@ -697,6 +699,75 @@ dirtomon(int dir)
return m;
}
+void
+dragfact(const Arg *arg)
+{
+ unsigned int n;
+ int px, py; // pointer coordinates
+ int dist_x, dist_y;
+ int horizontal = 0; // layout configuration
+ float mfact, cfact, cf, cw, ch, mw, mh;
+ Client *c;
+ Monitor *m = selmon;
+ XEvent ev;
+ Time lasttime = 0;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (!(c = m->sel) || !n || !m->lt[m->sellt]->arrange)
+ return;
+
+ /* Add custom handling for horizontal layouts here, e.g. */
+ // if (m->lt[m->sellt]->arrange == bstack)
+ // horizontal = 1;
+
+ if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
+ return;
+
+ if (!getrootptr(&px, &py))
+ return;
+
+ cf = c->cfact;
+ ch = c->h;
+ cw = c->w;
+ mw = m->ww * m->mfact;
+ mh = m->wh * m->mfact;
+
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch (ev.type) {
+ case ConfigureRequest:
+ case Expose:
+ case MapRequest:
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 40))
+ continue;
+ lasttime = ev.xmotion.time;
+
+ dist_x = ev.xmotion.x - px;
+ dist_y = ev.xmotion.y - py;
+
+ if (horizontal) {
+ cfact = (float) cf * (cw + dist_x) / cw;
+ mfact = (float) (mh + dist_y) / m->wh;
+ } else {
+ cfact = (float) cf * (ch - dist_y) / ch;
+ mfact = (float) (mw + dist_x) / m->ww;
+ }
+
+ c->cfact = MAX(0.25, MIN(4.0, cfact));
+ m->mfact = MAX(0.05, MIN(0.95, mfact));
+ arrangemon(m);
+ break;
+ }
+ } while (ev.type != ButtonRelease);
+
+ XUngrabPointer(dpy, CurrentTime);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
void
drawbar(Monitor *m)
{
@@ -1357,6 +1428,20 @@ resizemouse(const Arg *arg)
}
}
+void
+resizeorfacts(const Arg *arg)
+{
+ Monitor *m = selmon;
+
+ if (!m->sel)
+ return;
+
+ if (!m->lt[m->sellt]->arrange || m->sel->isfloating)
+ resizemouse(arg);
+ else
+ dragfact(arg);
+}
+
void
restack(Monitor *m)
{
@@ -1604,6 +1689,7 @@ setup(void)
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
+ cursor[CurDragFact] = drw_cur_create(drw, XC_rightbutton);
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
--
2.45.2

View File

@ -0,0 +1,280 @@
From 24baa1d2be62dac15e5f6b573112b7a4fb256ced Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9efa774..d6c2677 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,6 +71,9 @@ static const Key keys[] = {
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
+ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index f1d86b2..43108c6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -87,6 +87,7 @@ typedef struct Client Client;
struct Client {
char name[256];
float mina, maxa;
+ float cfact;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
@@ -201,6 +202,7 @@ static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
+static void setcfact(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
@@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa)
c->w = c->oldw = wa->width;
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
+ c->cfact = 1.0;
updatetitle(c);
if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
@@ -1521,6 +1524,24 @@ setlayout(const Arg *arg)
drawbar(selmon);
}
+void
+setcfact(const Arg *arg) {
+ float f;
+ Client *c;
+
+ c = selmon->sel;
+
+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f + c->cfact;
+ if(arg->f == 0.0)
+ f = 1.0;
+ else if(f < 0.25 || f > 4.0)
+ return;
+ c->cfact = f;
+ arrange(selmon);
+}
+
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
@@ -1688,9 +1709,15 @@ void
tile(Monitor *m)
{
unsigned int i, n, h, mw, my, ty;
+ float mfacts = 0, sfacts = 0;
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 < m->nmaster)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+ }
if (n == 0)
return;
@@ -1700,15 +1727,17 @@ tile(Monitor *m)
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);
+ h = (m->wh - my) * (c->cfact / mfacts);
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);
+ mfacts -= c->cfact;
} else {
- h = (m->wh - ty) / (n - i);
+ h = (m->wh - ty) * (c->cfact / sfacts);
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);
+ sfacts -= c->cfact;
}
}
--
2.45.2
From f5abc9603da0acfdcd77a5470488eee33dab6b6c Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:56:32 +0200
Subject: [PATCH 2/2] Adding dragfact patch (combines dragmfact and dragcfact)
---
config.def.h | 3 +-
dwm.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index d6c2677..bfe1166 100644
--- a/config.def.h
+++ b/config.def.h
@@ -110,7 +110,8 @@ static const Button buttons[] = {
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
- { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkClientWin, MODKEY, Button3, resizeorfacts, {0} },
+ { ClkClientWin, MODKEY|ShiftMask, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
diff --git a/dwm.c b/dwm.c
index 43108c6..15a0a3d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -58,7 +58,7 @@
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
-enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+enum { CurNormal, CurResize, CurMove, CurDragFact, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
@@ -162,6 +162,7 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
+static void dragfact(const Arg *arg);
static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
@@ -193,6 +194,7 @@ static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
+static void resizeorfacts(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
@@ -697,6 +699,75 @@ dirtomon(int dir)
return m;
}
+void
+dragfact(const Arg *arg)
+{
+ unsigned int n;
+ int px, py; // pointer coordinates
+ int dist_x, dist_y;
+ int horizontal = 0; // layout configuration
+ float mfact, cfact, cf, cw, ch, mw, mh;
+ Client *c;
+ Monitor *m = selmon;
+ XEvent ev;
+ Time lasttime = 0;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (!(c = m->sel) || !n || !m->lt[m->sellt]->arrange)
+ return;
+
+ /* Add custom handling for horizontal layouts here, e.g. */
+ // if (m->lt[m->sellt]->arrange == bstack)
+ // horizontal = 1;
+
+ if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
+ return;
+
+ if (!getrootptr(&px, &py))
+ return;
+
+ cf = c->cfact;
+ ch = c->h;
+ cw = c->w;
+ mw = m->ww * m->mfact;
+ mh = m->wh * m->mfact;
+
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch (ev.type) {
+ case ConfigureRequest:
+ case Expose:
+ case MapRequest:
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 40))
+ continue;
+ lasttime = ev.xmotion.time;
+
+ dist_x = ev.xmotion.x - px;
+ dist_y = ev.xmotion.y - py;
+
+ if (horizontal) {
+ cfact = (float) cf * (cw + dist_x) / cw;
+ mfact = (float) (mh + dist_y) / m->wh;
+ } else {
+ cfact = (float) cf * (ch - dist_y) / ch;
+ mfact = (float) (mw + dist_x) / m->ww;
+ }
+
+ c->cfact = MAX(0.25, MIN(4.0, cfact));
+ m->mfact = MAX(0.05, MIN(0.95, mfact));
+ arrangemon(m);
+ break;
+ }
+ } while (ev.type != ButtonRelease);
+
+ XUngrabPointer(dpy, CurrentTime);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
void
drawbar(Monitor *m)
{
@@ -1357,6 +1428,20 @@ resizemouse(const Arg *arg)
}
}
+void
+resizeorfacts(const Arg *arg)
+{
+ Monitor *m = selmon;
+
+ if (!m->sel)
+ return;
+
+ if (!m->lt[m->sellt]->arrange || m->sel->isfloating)
+ resizemouse(arg);
+ else
+ dragfact(arg);
+}
+
void
restack(Monitor *m)
{
@@ -1604,6 +1689,7 @@ setup(void)
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
+ cursor[CurDragFact] = drw_cur_create(drw, XC_rightbutton);
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
--
2.45.2

View File

@ -1,6 +1,6 @@
From 21552f49ebc1c64ccdbd57294858269b284391fd Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Fri, 8 May 2020 16:51:00 +0200
From 3c47efad069ed7721e2a4aafe0a39c6d48bdcf04 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:43:04 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -988,5 +988,5 @@ index 0000000..1a816b6
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 1f9992ae1a745a86294a555051ea17ba4ef5ce5f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Mon, 6 Apr 2020 12:04:55 +0200
From 4310ecf601e26f84966d9a1584a023ae52fa4cc8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:37:23 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -113,12 +112,12 @@ index 4465af1..5592c57 100644
}
--
2.19.1
2.45.2
From 21552f49ebc1c64ccdbd57294858269b284391fd Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Fri, 8 May 2020 16:51:00 +0200
From 3c47efad069ed7721e2a4aafe0a39c6d48bdcf04 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:43:04 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -1106,5 +1105,5 @@ index 0000000..1a816b6
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 5ab2e0de5244432354fc1cbb68c58a831b40ae5c Mon Sep 17 00:00:00 2001
From 5711ede1fc7a6f0e450a200e13ddad951871f104 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:26:11 +0100
Date: Wed, 26 Jun 2024 09:43:26 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -990,5 +990,5 @@ index 0000000..9b66d53
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 112abfec73e12282e4b0288f2e7739000ad135b6 Mon Sep 17 00:00:00 2001
From f3fbb79fd00a07443b300174fae59fe4c523d8f8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:21:06 +0100
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
Date: Wed, 26 Jun 2024 09:38:02 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,12 +114,12 @@ index a96f33c..bcb155d 100644
}
--
2.19.1
2.45.2
From 5ab2e0de5244432354fc1cbb68c58a831b40ae5c Mon Sep 17 00:00:00 2001
From 5711ede1fc7a6f0e450a200e13ddad951871f104 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:26:11 +0100
Date: Wed, 26 Jun 2024 09:43:26 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -1110,5 +1109,5 @@ index 0000000..9b66d53
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,6 +1,6 @@
From 0ca6196b1405b32617b33d811da390fd0c9dab11 Mon Sep 17 00:00:00 2001
From 1102816044e412f7d6b54c76564e2ede48d7fea8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:06:09 +0200
Date: Wed, 26 Jun 2024 09:43:50 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -990,5 +990,5 @@ index 0000000..9b66d53
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -1,10 +1,9 @@
From 484919dbd6095feb5a51cefd531c3c6bb3c92108 Mon Sep 17 00:00:00 2001
From b24a5d1f65b7dcbf26750414d19a0391a4e2b22a Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:02:47 +0200
Date: Wed, 26 Jun 2024 09:38:18 +0200
Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign
different weights to clients in their respective stack in tiled layout.
Refer to https://dwm.suckless.org/patches/cfacts/
---
config.def.h | 3 +++
dwm.c | 35 ++++++++++++++++++++++++++++++++---
@ -115,12 +114,12 @@ index e5efb6a..89d4f9a 100644
}
--
2.19.1
2.45.2
From 0ca6196b1405b32617b33d811da390fd0c9dab11 Mon Sep 17 00:00:00 2001
From 1102816044e412f7d6b54c76564e2ede48d7fea8 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Fri, 20 Oct 2023 22:06:09 +0200
Date: Wed, 26 Jun 2024 09:43:50 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
@ -1110,5 +1109,5 @@ index 0000000..9b66d53
+}
\ No newline at end of file
--
2.19.1
2.45.2

View File

@ -0,0 +1,994 @@
From c6892bddbb608b1a6229eb7887bed2688883079d Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Wed, 26 Jun 2024 09:44:05 +0200
Subject: [PATCH 2/2] vanitygaps - adds gaps to layouts
This patch differentiates between inner and outer gaps as well as
horizontal and vertical gaps.
The logic of these layouts also aims to be pixel perfect by ensuring
an even split of the available space and re-distributing the remainder
among the available clients.
---
config.def.h | 38 ++-
dwm.c | 45 +--
vanitygaps.c | 822 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 867 insertions(+), 38 deletions(-)
create mode 100644 vanitygaps.c
diff --git a/config.def.h b/config.def.h
index d6c2677..fa37e0c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,6 +3,11 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
+static const unsigned int gappih = 20; /* horiz inner gap between windows */
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
+static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */
+static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
@@ -37,11 +42,26 @@ 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 lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
+#include "vanitygaps.c"
+
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
- { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[@]", spiral },
+ { "[\\]", dwindle },
+ { "D[]", deck },
+ { "TTT", bstack },
+ { "===", bstackhoriz },
+ { "HHH", grid },
+ { "###", nrowgrid },
+ { "---", horizgrid },
+ { ":::", gaplessgrid },
+ { "|M|", centeredmaster },
+ { ">M>", centeredfloatingmaster },
+ { "><>", NULL }, /* no layout function means floating behavior */
+ { NULL, NULL },
};
/* key definitions */
@@ -75,6 +95,22 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
{ MODKEY, XK_Return, zoom, {0} },
+ { MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
+ { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
+ { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
diff --git a/dwm.c b/dwm.c
index 43108c6..5bbd733 100644
--- a/dwm.c
+++ b/dwm.c
@@ -120,6 +120,10 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
+ int gappih; /* horizontal gap between windows */
+ int gappiv; /* vertical gap between windows */
+ int gappoh; /* horizontal outer gaps */
+ int gappov; /* vertical outer gaps */
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@@ -210,7 +214,6 @@ static void showhide(Client *c);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
-static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -643,6 +646,10 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
+ m->gappih = gappih;
+ m->gappiv = gappiv;
+ m->gappoh = gappoh;
+ m->gappov = gappov;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1705,42 +1712,6 @@ tagmon(const Arg *arg)
sendmon(selmon->sel, dirtomon(arg->i));
}
-void
-tile(Monitor *m)
-{
- unsigned int i, n, h, mw, my, ty;
- float mfacts = 0, sfacts = 0;
- Client *c;
-
- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
- if (n < m->nmaster)
- mfacts += c->cfact;
- else
- sfacts += c->cfact;
- }
- 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) * (c->cfact / mfacts);
- 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);
- mfacts -= c->cfact;
- } else {
- h = (m->wh - ty) * (c->cfact / sfacts);
- 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);
- sfacts -= c->cfact;
- }
-}
-
void
togglebar(const Arg *arg)
{
diff --git a/vanitygaps.c b/vanitygaps.c
new file mode 100644
index 0000000..9b66d53
--- /dev/null
+++ b/vanitygaps.c
@@ -0,0 +1,822 @@
+/* Key binding functions */
+static void defaultgaps(const Arg *arg);
+static void incrgaps(const Arg *arg);
+static void incrigaps(const Arg *arg);
+static void incrogaps(const Arg *arg);
+static void incrohgaps(const Arg *arg);
+static void incrovgaps(const Arg *arg);
+static void incrihgaps(const Arg *arg);
+static void incrivgaps(const Arg *arg);
+static void togglegaps(const Arg *arg);
+/* Layouts (delete the ones you do not need) */
+static void bstack(Monitor *m);
+static void bstackhoriz(Monitor *m);
+static void centeredmaster(Monitor *m);
+static void centeredfloatingmaster(Monitor *m);
+static void deck(Monitor *m);
+static void dwindle(Monitor *m);
+static void fibonacci(Monitor *m, int s);
+static void grid(Monitor *m);
+static void nrowgrid(Monitor *m);
+static void spiral(Monitor *m);
+static void tile(Monitor *m);
+/* Internals */
+static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc);
+static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr);
+static void setgaps(int oh, int ov, int ih, int iv);
+
+/* Settings */
+#if !PERTAG_PATCH
+static int enablegaps = 1;
+#endif // PERTAG_PATCH
+
+void
+setgaps(int oh, int ov, int ih, int iv)
+{
+ if (oh < 0) oh = 0;
+ if (ov < 0) ov = 0;
+ if (ih < 0) ih = 0;
+ if (iv < 0) iv = 0;
+
+ selmon->gappoh = oh;
+ selmon->gappov = ov;
+ selmon->gappih = ih;
+ selmon->gappiv = iv;
+ arrange(selmon);
+}
+
+void
+togglegaps(const Arg *arg)
+{
+ #if PERTAG_PATCH
+ selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
+ #else
+ enablegaps = !enablegaps;
+ #endif // PERTAG_PATCH
+ arrange(NULL);
+}
+
+void
+defaultgaps(const Arg *arg)
+{
+ setgaps(gappoh, gappov, gappih, gappiv);
+}
+
+void
+incrgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov + arg->i,
+ selmon->gappih + arg->i,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+incrigaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih + arg->i,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+incrogaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov + arg->i,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
+void
+incrohgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
+void
+incrovgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov + arg->i,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
+void
+incrihgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih + arg->i,
+ selmon->gappiv
+ );
+}
+
+void
+incrivgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
+{
+ unsigned int n, oe, ie;
+ #if PERTAG_PATCH
+ oe = ie = m->pertag->enablegaps[m->pertag->curtag];
+ #else
+ oe = ie = enablegaps;
+ #endif // PERTAG_PATCH
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (smartgaps && n == 1) {
+ oe = 0; // outer gaps disabled when only one client
+ }
+
+ *oh = m->gappoh*oe; // outer horizontal gap
+ *ov = m->gappov*oe; // outer vertical gap
+ *ih = m->gappih*ie; // inner horizontal gap
+ *iv = m->gappiv*ie; // inner vertical gap
+ *nc = n; // number of clients
+}
+
+void
+getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr)
+{
+ unsigned int n;
+ float mfacts = 0, sfacts = 0;
+ int mtotal = 0, stotal = 0;
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
+ if (n < m->nmaster)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
+ if (n < m->nmaster)
+ mtotal += msize * (c->cfact / mfacts);
+ else
+ stotal += ssize * (c->cfact / sfacts);
+
+ *mf = mfacts; // total factor of master area
+ *sf = sfacts; // total factor of stack area
+ *mr = msize - mtotal; // the remainder (rest) of pixels after a cfacts master split
+ *sr = ssize - stotal; // the remainder (rest) of pixels after a cfacts stack split
+}
+
+/***
+ * Layouts
+ */
+
+/*
+ * Bottomstack layout + gaps
+ * https://dwm.suckless.org/patches/bottomstack/
+ */
+static void
+bstack(Monitor *m)
+{
+ unsigned int i, n;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ float mfacts, sfacts;
+ int mrest, srest;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ sh = mh = m->wh - 2*oh;
+ mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
+ sw = m->ww - 2*ov - iv * (n - m->nmaster - 1);
+
+ if (m->nmaster && n > m->nmaster) {
+ sh = (mh - ih) * (1 - m->mfact);
+ mh = mh - ih - sh;
+ sx = mx;
+ sy = my + mh + ih;
+ }
+
+ getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (i < m->nmaster) {
+ resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
+ mx += WIDTH(c) + iv;
+ } else {
+ resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
+ sx += WIDTH(c) + iv;
+ }
+ }
+}
+
+static void
+bstackhoriz(Monitor *m)
+{
+ unsigned int i, n;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ float mfacts, sfacts;
+ int mrest, srest;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ mh = m->wh - 2*oh;
+ sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
+ mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
+ sw = m->ww - 2*ov;
+
+ if (m->nmaster && n > m->nmaster) {
+ sh = (mh - ih) * (1 - m->mfact);
+ mh = mh - ih - sh;
+ sy = my + mh + ih;
+ sh = m->wh - mh - 2*oh - ih * (n - m->nmaster);
+ }
+
+ getfacts(m, mw, sh, &mfacts, &sfacts, &mrest, &srest);
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (i < m->nmaster) {
+ resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
+ mx += WIDTH(c) + iv;
+ } else {
+ resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
+ sy += HEIGHT(c) + ih;
+ }
+ }
+}
+
+/*
+ * Centred master layout + gaps
+ * https://dwm.suckless.org/patches/centeredmaster/
+ */
+void
+centeredmaster(Monitor *m)
+{
+ unsigned int i, n;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int lx = 0, ly = 0, lw = 0, lh = 0;
+ int rx = 0, ry = 0, rw = 0, rh = 0;
+ float mfacts = 0, lfacts = 0, rfacts = 0;
+ int mtotal = 0, ltotal = 0, rtotal = 0;
+ int mrest = 0, lrest = 0, rrest = 0;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ /* initialize areas */
+ mx = m->wx + ov;
+ my = m->wy + oh;
+ mh = m->wh - 2*oh - ih * ((!m->nmaster ? n : MIN(n, m->nmaster)) - 1);
+ mw = m->ww - 2*ov;
+ lh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - 1);
+ rh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - ((n - m->nmaster) % 2 ? 0 : 1));
+
+ if (m->nmaster && n > m->nmaster) {
+ /* go mfact box in the center if more than nmaster clients */
+ if (n - m->nmaster > 1) {
+ /* ||<-S->|<---M--->|<-S->|| */
+ mw = (m->ww - 2*ov - 2*iv) * m->mfact;
+ lw = (m->ww - mw - 2*ov - 2*iv) / 2;
+ rw = (m->ww - mw - 2*ov - 2*iv) - lw;
+ mx += lw + iv;
+ } else {
+ /* ||<---M--->|<-S->|| */
+ mw = (mw - iv) * m->mfact;
+ lw = 0;
+ rw = m->ww - mw - iv - 2*ov;
+ }
+ lx = m->wx + ov;
+ ly = m->wy + oh;
+ rx = mx + mw + iv;
+ ry = m->wy + oh;
+ }
+
+ /* calculate facts */
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
+ if (!m->nmaster || n < m->nmaster)
+ mfacts += c->cfact;
+ else if ((n - m->nmaster) % 2)
+ lfacts += c->cfact; // total factor of left hand stack area
+ else
+ rfacts += c->cfact; // total factor of right hand stack area
+ }
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
+ if (!m->nmaster || n < m->nmaster)
+ mtotal += mh * (c->cfact / mfacts);
+ else if ((n - m->nmaster) % 2)
+ ltotal += lh * (c->cfact / lfacts);
+ else
+ rtotal += rh * (c->cfact / rfacts);
+
+ mrest = mh - mtotal;
+ lrest = lh - ltotal;
+ rrest = rh - rtotal;
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (!m->nmaster || i < m->nmaster) {
+ /* nmaster clients are stacked vertically, in the center of the screen */
+ resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
+ my += HEIGHT(c) + ih;
+ } else {
+ /* stack clients are stacked vertically */
+ if ((i - m->nmaster) % 2 ) {
+ resize(c, lx, ly, lw - (2*c->bw), lh * (c->cfact / lfacts) + ((i - 2*m->nmaster) < 2*lrest ? 1 : 0) - (2*c->bw), 0);
+ ly += HEIGHT(c) + ih;
+ } else {
+ resize(c, rx, ry, rw - (2*c->bw), rh * (c->cfact / rfacts) + ((i - 2*m->nmaster) < 2*rrest ? 1 : 0) - (2*c->bw), 0);
+ ry += HEIGHT(c) + ih;
+ }
+ }
+ }
+}
+
+void
+centeredfloatingmaster(Monitor *m)
+{
+ unsigned int i, n;
+ float mfacts, sfacts;
+ float mivf = 1.0; // master inner vertical gap factor
+ int oh, ov, ih, iv, mrest, srest;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ sh = mh = m->wh - 2*oh;
+ mw = m->ww - 2*ov - iv*(n - 1);
+ sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
+
+ if (m->nmaster && n > m->nmaster) {
+ mivf = 0.8;
+ /* go mfact box in the center if more than nmaster clients */
+ if (m->ww > m->wh) {
+ mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
+ mh = m->wh * 0.9;
+ } else {
+ mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
+ mh = m->wh * m->mfact;
+ }
+ mx = m->wx + (m->ww - mw) / 2;
+ my = m->wy + (m->wh - mh - 2*oh) / 2;
+
+ sx = m->wx + ov;
+ sy = m->wy + oh;
+ sh = m->wh - 2*oh;
+ }
+
+ getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+ /* nmaster clients are stacked horizontally, in the center of the screen */
+ resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
+ mx += WIDTH(c) + iv*mivf;
+ } else {
+ /* stack clients are stacked horizontally */
+ resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
+ sx += WIDTH(c) + iv;
+ }
+}
+
+/*
+ * Deck layout + gaps
+ * https://dwm.suckless.org/patches/deck/
+ */
+void
+deck(Monitor *m)
+{
+ unsigned int i, n;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ float mfacts, sfacts;
+ int mrest, srest;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
+ sw = mw = m->ww - 2*ov;
+
+ if (m->nmaster && n > m->nmaster) {
+ sw = (mw - iv) * (1 - m->mfact);
+ mw = mw - iv - sw;
+ sx = mx + mw + iv;
+ sh = m->wh - 2*oh;
+ }
+
+ getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
+
+ if (n - m->nmaster > 0) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+ resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
+ my += HEIGHT(c) + ih;
+ } else {
+ resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
+ }
+}
+
+/*
+ * Fibonacci layout + gaps
+ * https://dwm.suckless.org/patches/fibonacci/
+ */
+void
+fibonacci(Monitor *m, int s)
+{
+ unsigned int i, n;
+ int nx, ny, nw, nh;
+ int oh, ov, ih, iv;
+ int nv, hrest = 0, wrest = 0, r = 1;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ nx = m->wx + ov;
+ ny = m->wy + oh;
+ nw = m->ww - 2*ov;
+ nh = m->wh - 2*oh;
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+ if (r) {
+ if ((i % 2 && (nh - ih) / 2 <= (bh + 2*c->bw))
+ || (!(i % 2) && (nw - iv) / 2 <= (bh + 2*c->bw))) {
+ r = 0;
+ }
+ if (r && i < n - 1) {
+ if (i % 2) {
+ nv = (nh - ih) / 2;
+ hrest = nh - 2*nv - ih;
+ nh = nv;
+ } else {
+ nv = (nw - iv) / 2;
+ wrest = nw - 2*nv - iv;
+ nw = nv;
+ }
+
+ if ((i % 4) == 2 && !s)
+ nx += nw + iv;
+ else if ((i % 4) == 3 && !s)
+ ny += nh + ih;
+ }
+
+ if ((i % 4) == 0) {
+ if (s) {
+ ny += nh + ih;
+ nh += hrest;
+ }
+ else {
+ nh -= hrest;
+ ny -= nh + ih;
+ }
+ }
+ else if ((i % 4) == 1) {
+ nx += nw + iv;
+ nw += wrest;
+ }
+ else if ((i % 4) == 2) {
+ ny += nh + ih;
+ nh += hrest;
+ if (i < n - 1)
+ nw += wrest;
+ }
+ else if ((i % 4) == 3) {
+ if (s) {
+ nx += nw + iv;
+ nw -= wrest;
+ } else {
+ nw -= wrest;
+ nx -= nw + iv;
+ nh += hrest;
+ }
+ }
+ if (i == 0) {
+ if (n != 1) {
+ nw = (m->ww - iv - 2*ov) - (m->ww - iv - 2*ov) * (1 - m->mfact);
+ wrest = 0;
+ }
+ ny = m->wy + oh;
+ }
+ else if (i == 1)
+ nw = m->ww - nw - iv - 2*ov;
+ i++;
+ }
+
+ resize(c, nx, ny, nw - (2*c->bw), nh - (2*c->bw), False);
+ }
+}
+
+void
+dwindle(Monitor *m)
+{
+ fibonacci(m, 1);
+}
+
+void
+spiral(Monitor *m)
+{
+ fibonacci(m, 0);
+}
+
+/*
+ * Gappless grid layout + gaps (ironically)
+ * https://dwm.suckless.org/patches/gaplessgrid/
+ */
+void
+gaplessgrid(Monitor *m)
+{
+ unsigned int i, n;
+ int x, y, cols, rows, ch, cw, cn, rn, rrest, crest; // counters
+ int oh, ov, ih, iv;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ /* grid dimensions */
+ for (cols = 0; cols <= n/2; cols++)
+ if (cols*cols >= n)
+ break;
+ if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
+ cols = 2;
+ rows = n/cols;
+ cn = rn = 0; // reset column no, row no, client count
+
+ ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
+ cw = (m->ww - 2*ov - iv * (cols - 1)) / cols;
+ rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
+ crest = (m->ww - 2*ov - iv * (cols - 1)) - cw * cols;
+ x = m->wx + ov;
+ y = m->wy + oh;
+
+ for (i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
+ if (i/rows + 1 > cols - n%cols) {
+ rows = n/cols + 1;
+ ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
+ rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
+ }
+ resize(c,
+ x,
+ y + rn*(ch + ih) + MIN(rn, rrest),
+ cw + (cn < crest ? 1 : 0) - 2*c->bw,
+ ch + (rn < rrest ? 1 : 0) - 2*c->bw,
+ 0);
+ rn++;
+ if (rn >= rows) {
+ rn = 0;
+ x += cw + ih + (cn < crest ? 1 : 0);
+ cn++;
+ }
+ }
+}
+
+/*
+ * Gridmode layout + gaps
+ * https://dwm.suckless.org/patches/gridmode/
+ */
+void
+grid(Monitor *m)
+{
+ unsigned int i, n;
+ int cx, cy, cw, ch, cc, cr, chrest, cwrest, cols, rows;
+ int oh, ov, ih, iv;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+
+ /* grid dimensions */
+ for (rows = 0; rows <= n/2; rows++)
+ if (rows*rows >= n)
+ break;
+ cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;
+
+ /* window geoms (cell height/width) */
+ ch = (m->wh - 2*oh - ih * (rows - 1)) / (rows ? rows : 1);
+ cw = (m->ww - 2*ov - iv * (cols - 1)) / (cols ? cols : 1);
+ chrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
+ cwrest = (m->ww - 2*ov - iv * (cols - 1)) - cw * cols;
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ cc = i / rows;
+ cr = i % rows;
+ cx = m->wx + ov + cc * (cw + iv) + MIN(cc, cwrest);
+ cy = m->wy + oh + cr * (ch + ih) + MIN(cr, chrest);
+ resize(c, cx, cy, cw + (cc < cwrest ? 1 : 0) - 2*c->bw, ch + (cr < chrest ? 1 : 0) - 2*c->bw, False);
+ }
+}
+
+/*
+ * Horizontal grid layout + gaps
+ * https://dwm.suckless.org/patches/horizgrid/
+ */
+void
+horizgrid(Monitor *m) {
+ Client *c;
+ unsigned int n, i;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ int ntop, nbottom = 1;
+ float mfacts = 0, sfacts = 0;
+ int mrest, srest, mtotal = 0, stotal = 0;
+
+ /* Count windows */
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ if (n <= 2)
+ ntop = n;
+ else {
+ ntop = n / 2;
+ nbottom = n - ntop;
+ }
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ sh = mh = m->wh - 2*oh;
+ sw = mw = m->ww - 2*ov;
+
+ if (n > ntop) {
+ sh = (mh - ih) / 2;
+ mh = mh - ih - sh;
+ sy = my + mh + ih;
+ mw = m->ww - 2*ov - iv * (ntop - 1);
+ sw = m->ww - 2*ov - iv * (nbottom - 1);
+ }
+
+ /* calculate facts */
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < ntop)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < ntop)
+ mtotal += mh * (c->cfact / mfacts);
+ else
+ stotal += sw * (c->cfact / sfacts);
+
+ mrest = mh - mtotal;
+ srest = sw - stotal;
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < ntop) {
+ resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
+ mx += WIDTH(c) + iv;
+ } else {
+ resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - ntop) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
+ sx += WIDTH(c) + iv;
+ }
+}
+
+/*
+ * nrowgrid layout + gaps
+ * https://dwm.suckless.org/patches/nrowgrid/
+ */
+void
+nrowgrid(Monitor *m)
+{
+ unsigned int n;
+ int ri = 0, ci = 0; /* counters */
+ int oh, ov, ih, iv; /* vanitygap settings */
+ unsigned int cx, cy, cw, ch; /* client geometry */
+ unsigned int uw = 0, uh = 0, uc = 0; /* utilization trackers */
+ unsigned int cols, rows = m->nmaster + 1;
+ Client *c;
+
+ /* count clients */
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+
+ /* nothing to do here */
+ if (n == 0)
+ return;
+
+ /* force 2 clients to always split vertically */
+ if (FORCE_VSPLIT && n == 2)
+ rows = 1;
+
+ /* never allow empty rows */
+ if (n < rows)
+ rows = n;
+
+ /* define first row */
+ cols = n / rows;
+ uc = cols;
+ cy = m->wy + oh;
+ ch = (m->wh - 2*oh - ih*(rows - 1)) / rows;
+ uh = ch;
+
+ for (c = nexttiled(m->clients); c; c = nexttiled(c->next), ci++) {
+ if (ci == cols) {
+ uw = 0;
+ ci = 0;
+ ri++;
+
+ /* next row */
+ cols = (n - uc) / (rows - ri);
+ uc += cols;
+ cy = m->wy + oh + uh + ih;
+ uh += ch + ih;
+ }
+
+ cx = m->wx + ov + uw;
+ cw = (m->ww - 2*ov - uw) / (cols - ci);
+ uw += cw + iv;
+
+ resize(c, cx, cy, cw - (2*c->bw), ch - (2*c->bw), 0);
+ }
+}
+
+/*
+ * Default tile layout + gaps
+ */
+static void
+tile(Monitor *m)
+{
+ unsigned int i, n;
+ int oh, ov, ih, iv;
+ int mx = 0, my = 0, mh = 0, mw = 0;
+ int sx = 0, sy = 0, sh = 0, sw = 0;
+ float mfacts, sfacts;
+ int mrest, srest;
+ Client *c;
+
+ getgaps(m, &oh, &ov, &ih, &iv, &n);
+ if (n == 0)
+ return;
+
+ sx = mx = m->wx + ov;
+ sy = my = m->wy + oh;
+ mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
+ sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
+ sw = mw = m->ww - 2*ov;
+
+ if (m->nmaster && n > m->nmaster) {
+ sw = (mw - iv) * (1 - m->mfact);
+ mw = mw - iv - sw;
+ sx = mx + mw + iv;
+ }
+
+ getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
+
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+ resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
+ my += HEIGHT(c) + ih;
+ } else {
+ resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
+ sy += HEIGHT(c) + ih;
+ }
+}
\ No newline at end of file
--
2.45.2

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More