aboutsummaryrefslogtreecommitdiffstats
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c48
1 files changed, 43 insertions, 5 deletions
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;