summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h6
-rw-r--r--dwl.c23
2 files changed, 28 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index 71d67e9..9d3dc35 100644
--- a/config.def.h
+++ b/config.def.h
@@ -41,9 +41,13 @@ static const char *termcmd[] = { "kitty", "-o", "linux_display_server=wayland",
static const Key keys[] = {
/* modifier key function argument */
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd } },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
+ { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
+ { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
+ { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
+ { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
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)
{