[wiki] [sites] [dwm][patch][flextile] Update for dwm commit 138b405 || Max Schillinger
commit 2d3af3fc4c2a2351d849c5978969229afb9a5d49
Author: Max Schillinger <maxschillinger_AT_web.de>
Date: Thu Jul 22 23:38:56 2021 +0200
[dwm][patch][flextile] Update for dwm commit 138b405
Further changes:
- Remove nmaster and incnmaster because flextile replaces them
- Use incnmaster key bindings for flextile's shiftmastersplit instead
- Change Bool to int (like it happened in dwm meanwhile)
- Opening { on own line for functions defined in flextile.h
- Indent with tabs
diff --git a/dwm.suckless.org/patches/flextile/dwm-flextile-6.2.diff b/dwm.suckless.org/patches/flextile/dwm-flextile-20210722-138b405.diff
similarity index 79%
rename from dwm.suckless.org/patches/flextile/dwm-flextile-6.2.diff
rename to dwm.suckless.org/patches/flextile/dwm-flextile-20210722-138b405.diff
index 99ecb136..f6028ee4 100644
--- a/dwm.suckless.org/patches/flextile/dwm-flextile-6.2.diff
+++ b/dwm.suckless.org/patches/flextile/dwm-flextile-20210722-138b405.diff
_AT_@ -1,17 +1,17 @@
-From 63354ec03bb7c1138bac60cec146c29e19230f32 Mon Sep 17 00:00:00 2001
+From cb3d26193fafd0b06217c3bf2d65a6eac74b4941 Mon Sep 17 00:00:00 2001
From: Max Schillinger <maxschillinger_AT_web.de>
-Date: Fri, 2 Jul 2021 22:39:37 +0200
-Subject: [PATCH] apply dwm-flextile-6.2.diff
+Date: Thu, 22 Jul 2021 23:19:36 +0200
+Subject: [PATCH] flextile layout for dwm commit 138b405
---
- config.def.h | 14 +++++
- dwm.c | 114 +++++++++++++++++++-----------------
- flextile.h | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 235 insertions(+), 53 deletions(-)
+ config.def.h | 17 +++++-
+ dwm.c | 123 +++++++++++++++++++-------------------
+ flextile.h | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 238 insertions(+), 65 deletions(-)
create mode 100644 flextile.h
diff --git a/config.def.h b/config.def.h
-index 1c0b587..0a8c20f 100644
+index a2ac963..1330db2 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -21,6 +21,9 @@ static const char *colors[][3] = {
_AT_@ -24,19 +24,32 @@ index 1c0b587..0a8c20f 100644
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
-_AT_@ -35,6 +38,11 @@ static const Rule rules[] = {
+_AT_@ -33,8 +36,12 @@ static const Rule rules[] = {
+
+ /* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
- static const int nmaster = 1; /* number of clients in master area */
+-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 layoutaxis[] = {
+ 1, /* layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top */
+ 2, /* master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle) */
+ 2, /* stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle) */
+};
+ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
- /* symbol arrange function */
-_AT_@ -94,6 +102,12 @@ static Key keys[] = {
+_AT_@ -67,8 +74,8 @@ static Key keys[] = {
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+- { MODKEY, XK_i, incnmaster, {.i = +1 } },
+- { MODKEY, XK_d, incnmaster, {.i = -1 } },
++ { MODKEY, XK_i, shiftmastersplit, {.i = +1} }, /* increase the number of tiled clients in the master area */
++ { MODKEY, XK_d, shiftmastersplit, {.i = -1} }, /* reduce the number of tiled clients in the master area */
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+ { MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY, XK_Return, zoom, {0} },
+_AT_@ -95,6 +102,10 @@ static Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
_AT_@ -44,13 +57,11 @@ index 1c0b587..0a8c20f 100644
+ { MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1} }, /* 1 = master axis */
+ { MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2} }, /* 2 = stack axis */
+ { MODKEY|ControlMask, XK_Return, mirrorlayout, {0} },
-+ { MODKEY|ControlMask, XK_h, shiftmastersplit, {.i = -1} }, /* reduce the number of tiled clients in the master area */
-+ { MODKEY|ControlMask, XK_l, shiftmastersplit, {.i = +1} }, /* increase the number of tiled clients in the master area */
};
/* button definitions */
diff --git a/dwm.c b/dwm.c
-index b0b3466..367bf78 100644
+index 5e4d494..1f1487a 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -111,27 +111,6 @@ typedef struct {
_AT_@ -81,7 +92,15 @@ index b0b3466..367bf78 100644
typedef struct {
const char *class;
const char *instance;
-_AT_@ -631,6 +610,7 @@ configurerequest(XEvent *e)
+_AT_@ -175,7 +154,6 @@ 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 incnmaster(const Arg *arg);
+ static void keypress(XEvent *e);
+ static void killclient(const Arg *arg);
+ static void manage(Window w, XWindowAttributes *wa);
+_AT_@ -631,17 +609,32 @@ configurerequest(XEvent *e)
Monitor *
createmon(void)
{
_AT_@ -89,7 +108,11 @@ index b0b3466..367bf78 100644
Monitor *m;
m = ecalloc(1, sizeof(Monitor));
-_AT_@ -642,6 +622,21 @@ createmon(void)
+ m->tagset[0] = m->tagset[1] = 1;
+ m->mfact = mfact;
+- m->nmaster = nmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
_AT_@ -98,20 +121,34 @@ index b0b3466..367bf78 100644
+ m->ltaxis[2] = layoutaxis[2];
+ m->msplit = 1;
+ /* init tags, bars, layouts, axes, msplits and mfacts */
-+ m->curtag = m->prevtag = 1;
-+ for(i = 0; i < LENGTH(tags) + 1; i++){
-+ m->showbars[i] = m->showbar;
-+ m->lts[i] = &layouts[0];
-+ m->mfacts[i] = m->mfact;
-+ m->ltaxes[i][0] = m->ltaxis[0];
-+ m->ltaxes[i][1] = m->ltaxis[1];
-+ m->ltaxes[i][2] = m->ltaxis[2];
-+ m->msplits[i] = m->msplit;
-+ }
++ m->curtag = m->prevtag = 1;
++ for(i = 0; i < LENGTH(tags) + 1; i++){
++ m->showbars[i] = m->showbar;
++ m->lts[i] = &layouts[0];
++ m->mfacts[i] = m->mfact;
++ m->ltaxes[i][0] = m->ltaxis[0];
++ m->ltaxes[i][1] = m->ltaxis[1];
++ m->ltaxes[i][2] = m->ltaxis[2];
++ m->msplits[i] = m->msplit;
++ }
return m;
}
-_AT_@ -1504,7 +1499,7 @@ setlayout(const Arg *arg)
+_AT_@ -964,13 +957,6 @@ grabkeys(void)
+ }
+ }
+
+-void
+-incnmaster(const Arg *arg)
+-{
+- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
+- arrange(selmon);
+-}
+-
+ #ifdef XINERAMA
+ static int
+ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
+_AT_@ -1504,7 +1490,7 @@ setlayout(const Arg *arg)
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
selmon->sellt ^= 1;
if (arg && arg->v)
_AT_@ -120,7 +157,7 @@ index b0b3466..367bf78 100644
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel)
arrange(selmon);
-_AT_@ -1523,7 +1518,7 @@ setmfact(const Arg *arg)
+_AT_@ -1523,7 +1509,7 @@ setmfact(const Arg *arg)
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95)
return;
_AT_@ -129,7 +166,7 @@ index b0b3466..367bf78 100644
arrange(selmon);
}
-_AT_@ -1671,38 +1666,10 @@ tagmon(const Arg *arg)
+_AT_@ -1671,38 +1657,10 @@ tagmon(const Arg *arg)
sendmon(selmon->sel, dirtomon(arg->i));
}
_AT_@ -169,7 +206,7 @@ index b0b3466..367bf78 100644
updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon);
-_AT_@ -1726,12 +1693,31 @@ void
+_AT_@ -1726,12 +1684,31 @@ void
toggletag(const Arg *arg)
{
unsigned int newtags;
_AT_@ -201,7 +238,7 @@ index b0b3466..367bf78 100644
focus(NULL);
arrange(selmon);
}
-_AT_@ -2038,11 +2024,33 @@ updatewmhints(Client *c)
+_AT_@ -2038,11 +2015,33 @@ updatewmhints(Client *c)
void
view(const Arg *arg)
{
_AT_@ -238,17 +275,16 @@ index b0b3466..367bf78 100644
}
diff --git a/flextile.h b/flextile.h
new file mode 100644
-index 0000000..9735cf9
+index 0000000..edab893
--- /dev/null
+++ b/flextile.h
-_AT_@ -0,0 +1,160 @@
+_AT_@ -0,0 +1,163 @@
+/* See LICENSE file for copyright and license details. */
+/* © 2010 joten <joten_AT_freenet.de> */
+
+struct Monitor {
+ char ltsymbol[16];
+ float mfact;
-+ int nmaster;
+ double mfacts[LENGTH(tags) + 1];
+ int ltaxis[3];
+ int ltaxes[LENGTH(tags) + 1][3];
_AT_@ -263,9 +299,9 @@ index 0000000..9735cf9
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
-+ Bool showbar;
-+ Bool showbars[LENGTH(tags) + 1];
-+ Bool topbar;
++ int showbar;
++ int showbars[LENGTH(tags) + 1];
++ int topbar;
+ Client *clients;
+ Client *sel;
+ Client *stack;
_AT_@ -281,7 +317,8 @@ index 0000000..9735cf9
+static void shiftmastersplit(const Arg *arg);
+
+void
-+mirrorlayout(const Arg *arg) {
++mirrorlayout(const Arg *arg)
++{
+ if(!selmon->lt[selmon->sellt]->arrange)
+ return;
+ selmon->ltaxis[0] *= -1;
_AT_@ -290,7 +327,8 @@ index 0000000..9735cf9
+}
+
+void
-+rotatelayoutaxis(const Arg *arg) {
++rotatelayoutaxis(const Arg *arg)
++{
+ if(!selmon->lt[selmon->sellt]->arrange)
+ return;
+ if(arg->i == 0) {
_AT_@ -305,7 +343,8 @@ index 0000000..9735cf9
+}
+
+void
-+shiftmastersplit(const Arg *arg) {
++shiftmastersplit(const Arg *arg)
++{
+ unsigned int n;
+ Client *c;
+
_AT_@ -318,7 +357,8 @@ index 0000000..9735cf9
+}
+
+void
-+tile(Monitor *m) {
++tile(Monitor *m)
++{
+ char sym1 = 61, sym2 = 93, sym3 = 61, sym;
+ int x1 = m->wx, y1 = m->wy, h1 = m->wh, w1 = m->ww, X1 = x1 + w1, Y1 = y1 + h1;
+ int x2 = m->wx, y2 = m->wy, h2 = m->wh, w2 = m->ww, X2 = x2 + w2, Y2 = y2 + h2;
diff --git a/dwm.suckless.org/patches/flextile/index.md b/dwm.suckless.org/patches/flextile/index.md
index 44f89add..801420fe 100644
--- a/dwm.suckless.org/patches/flextile/index.md
+++ b/dwm.suckless.org/patches/flextile/index.md
_AT_@ -45,13 +45,14 @@ Configuration
static const unsigned int mastersplit = 1; /* number of tiled clients in the master area */
static Key keys[] = {
+ ...
+ { MODKEY, XK_i, shiftmastersplit, {.i = +1} }, /* increase the number of tiled clients in the master area */
+ { MODKEY, XK_d, shiftmastersplit, {.i = -1} }, /* reduce the number of tiled clients in the master area */
...
{ MODKEY|ControlMask, XK_t, rotatelayoutaxis, {.i = 0} }, /* 0 = layout axis */
{ MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1} }, /* 1 = master axis */
{ MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2} }, /* 2 = stack axis */
{ MODKEY|ControlMask, XK_Return, mirrorlayout, {0} },
- { MODKEY|ControlMask, XK_h, shiftmastersplit, {.i = -1} }, /* reduce the number of tiled clients in the master area */
- { MODKEY|ControlMask, XK_l, shiftmastersplit, {.i = +1} }, /* increase the number of tiled clients in the master area */
Usage
_AT_@ -67,7 +68,7 @@ pressing `ALT+m` (in the default configuration).
Download
--------
-* [dwm-flextile-6.2.diff](dwm-flextile-6.2.diff)
+* [dwm-flextile-20210722-138b405.diff](dwm-flextile-20210722-138b405.diff)
* [dwm-flextile-5.8.2.diff](dwm-flextile-5.8.2.diff)
* [dwm-flextile-5.8.1.diff](dwm-flextile-5.8.1.diff)
Received on Thu Jul 22 2021 - 23:50:50 CEST
This archive was generated by hypermail 2.3.0
: Fri Jul 23 2021 - 00:01:03 CEST