summaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-23 20:14:11 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-23 22:11:52 -0500
commit4eabe48fed38b94e810768dd8523cba3cbd5bae2 (patch)
tree260f854c61fe8f65f6674bd877ce9c5090e96f93 /dwl.c
parent66054700cb58d97f3f333317db18b24e0f39ef2c (diff)
add incnmaster and setmfact commands
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index c58a7e0..c813268 100644
--- a/dwl.c
+++ b/dwl.c
@@ -30,6 +30,7 @@
#include <xkbcommon/xkbcommon.h>
/* macros */
+#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
#define VISIBLEON(C, M) ((C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
@@ -131,6 +132,7 @@ static void cursorframe(struct wl_listener *listener, void *data);
static void destroynotify(struct wl_listener *listener, void *data);
static void focus(Client *c, struct wlr_surface *surface);
static void focusstack(const Arg *arg);
+static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
static bool keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data);
@@ -149,6 +151,7 @@ static void run(char *startup_cmd);
static Client *selclient(void);
static void setcursor(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg);
+static void setmfact(const Arg *arg);
static void setup(void);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
@@ -470,6 +473,12 @@ focusstack(const Arg *arg)
}
void
+incnmaster(const Arg *arg)
+{
+ selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
+}
+
+void
inputdevice(struct wl_listener *listener, void *data)
{
/* This event is raised by the backend when a new input device becomes
@@ -949,6 +958,20 @@ setlayout(const Arg *arg)
/* XXX change layout symbol? */
}
+/* arg > 1.0 will set mfact absolutely */
+void
+setmfact(const Arg *arg)
+{
+ float f;
+
+ if (!arg || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
+ if (f < 0.1 || f > 0.9)
+ return;
+ selmon->mfact = f;
+}
+
void
setup(void)
{