aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Leonhardt <equinox.salexander@gmail.com>
2026-10-18 12:34:02 +0200
committerAlexander Leonhardt <equinox.salexander@gmail.com>
2026-10-18 12:34:02 +0200
commit1989b7cbd41a742cdeddaeb1d8793c1123d916fd (patch)
treefaee1a5ec94b2227648a9235dabc53c6d6bfe80e
parent844659ab02d126db6f793f73256786e1a8598d42 (diff)
downloaddwl-1989b7cbd41a742cdeddaeb1d8793c1123d916fd.tar.gz
dwl-1989b7cbd41a742cdeddaeb1d8793c1123d916fd.tar.bz2
dwl-1989b7cbd41a742cdeddaeb1d8793c1123d916fd.zip
Added ability to stack master across arbitrary axis
-rw-r--r--config.def.h12
-rw-r--r--dwl.c48
2 files changed, 49 insertions, 11 deletions
diff --git a/config.def.h b/config.def.h
index 15f6660..58e8b94 100644
--- a/config.def.h
+++ b/config.def.h
@@ -20,6 +20,8 @@ static const float unfocuseddim[] = COLOR(0x00000033);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
+static const bool horizontal_master = true;
+
static uint32_t colors[][3] = {
/* fg bg border */
[SchemeNorm] = { 0xbbbbbbff, 0x000000ff, 0x444444ff },
@@ -68,7 +70,8 @@ static const MonitorRule monrules[] = {
* example of a HiDPI laptop monitor:
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
{ "Samsung Display Corp. 0x4193", 0.55f, 1, 1.7f, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
- { "DP-3", 0.55f, 1, 1.7f, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ { "Dell Inc. DELL U4025QW BVFFMF4", 0.55f, 1, 1.7f, &layouts[3], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ { "Dell Inc. DELL P3424WE B2066T3", 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
};
@@ -162,11 +165,8 @@ static const Key keys[] = {
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_z, addscratchpad, {0} },
{ MODKEY, XKB_KEY_z, togglescratchpad, {0} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_z, removescratchpad, {0} },
- { MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
- { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
- { MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
- { MODKEY, XKB_KEY_c, setlayout, {.v = &layouts[3]} },
- { MODKEY, XKB_KEY_space, setlayout, {0} },
+ { MODKEY, XKB_KEY_space, cyclelayout, {0} },
+ { MODKEY, XKB_KEY_a, swapaxis, {0} },
{ MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
diff --git a/dwl.c b/dwl.c
index 1a9a3a9..87a1ef0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -379,6 +379,8 @@ static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
+static void cyclelayout(const Arg *arg);
+static void swapaxis(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags);
static void setpsel(struct wl_listener *listener, void *data);
@@ -535,6 +537,7 @@ struct Pertag {
int nmasters[sizeof(tags)/sizeof(tags[0]) + 1]; /* number of windows in master area */
float mfacts[sizeof(tags)/sizeof(tags[0]) + 1]; /* mfacts per tag */
unsigned int sellts[sizeof(tags)/sizeof(tags[0]) + 1]; /* selected layouts */
+ bool selaxis[sizeof(tags)/sizeof(tags[0]) + 1]; /* selected layouts */
const Layout *ltidxs[sizeof(tags)/sizeof(tags[0]) + 1][2]; /* matrix of tags and layouts indexes */
};
static struct wl_list scratchpad_clients[SCRATCHPAD_COUNT];
@@ -1389,6 +1392,7 @@ createmon(struct wl_listener *listener, void *data)
m->pertag->ltidxs[i][0] = m->lt[0];
m->pertag->ltidxs[i][1] = m->lt[1];
m->pertag->sellts[i] = m->sellt;
+ m->pertag->selaxis[i] = horizontal_master;
}
/* The xdg-protocol specifies:
@@ -2931,6 +2935,28 @@ setfullscreen(Client *c, int fullscreen)
drawbars();
}
+
+void
+cyclelayout(const Arg *arg)
+{
+ static unsigned int idx = 1;
+ Arg a = {.v = &layouts[idx]};
+ setlayout(&a);
+ idx += 1;
+ if (idx >= sizeof(layouts)/sizeof(Layout)) {
+ idx = 0;
+ }
+}
+
+
+void
+swapaxis(const Arg *arg) {
+ if(selmon) {
+ selmon->pertag->selaxis[selmon->pertag->curtag] = !selmon->pertag->selaxis[selmon->pertag->curtag];
+ arrange(selmon);
+ }
+}
+
void
setlayout(const Arg *arg)
{
@@ -3315,7 +3341,8 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int h, r, e = m->gaps, mw, my, ty;
+ unsigned int w, r, e = m->gaps, mw, my, ty;
+ unsigned int h = m->gaps;
int i, n = 0;
Client *c;
@@ -3338,10 +3365,21 @@ tile(Monitor *m)
continue;
if (i < m->nmaster) {
r = MIN(n, m->nmaster) - i;
- h = (m->w.height - my - gappx*e - gappx*e * (r - 1)) / r;
- resize(c, (struct wlr_box){.x = m->w.x + gappx*e, .y = m->w.y + my,
- .width = mw - 2*gappx*e, .height = h}, 0);
- my += c->geom.height + gappx*e;
+ if (m->pertag->selaxis[m->pertag->curtag]) {
+ //h = (m->w.height - my - gappx*e - gappx*e * (r - 1)) / r;
+ w = (mw - my - gappx*e - gappx*e * (r - 1)) / r;
+ //resize(c, (struct wlr_box){.x = m->w.x + gappx*e, .y = m->w.y + my,
+ // .width = mw - 2*gappx*e, .height = h}, 0);
+ resize(c, (struct wlr_box){.x = m->w.x + my, .y = m->w.y + gappx*e,
+ .width = w, .height = m->w.height - 2*gappx*e}, 0);
+ my += c->geom.width + gappx*e;
+ }
+ else {
+ h = (m->w.height - my - gappx*e - gappx*e * (r - 1)) / r;
+ resize(c, (struct wlr_box){.x = m->w.x + gappx*e, .y = m->w.y + my,
+ .width = mw - 2*gappx*e, .height = h}, 0);
+ my += c->geom.height + gappx*e;
+ }
} else {
r = n - i;
h = (m->w.height - ty - gappx*e - gappx*e * (r - 1)) / r;