Files
dwl-patches/patches/moveresizekb/moveresizekb.patch
T
2026-06-19 19:25:44 -03:00

75 lines
2.8 KiB
Diff

From f19c162ba64c2c4860e5d16e48e08cebd7a7e46c Mon Sep 17 00:00:00 2001
From: C4FE1 <heitorcdesousa13@gmail.com>
Date: Wed, 10 Jun 2026 19:50:26 -0300
Subject: [PATCH] Change moveresizekb logic to allow it's use in floating
(NULL) Layout
---
config.def.h | 8 ++++++++
dwl.c | 23 +++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/config.def.h b/config.def.h
index 8a6eda0..b8398f9 100644
--- a/config.def.h
+++ b/config.def.h
@@ -138,6 +138,14 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY, XKB_KEY_Down, moveresizekb, {.v = (int []){ 0, 40, 0, 0 }}},
+ { MODKEY, XKB_KEY_Up, moveresizekb, {.v = (int []){ 0, -40, 0, 0 }}},
+ { MODKEY, XKB_KEY_Right, moveresizekb, {.v = (int []){ 40, 0, 0, 0 }}},
+ { MODKEY, XKB_KEY_Left, moveresizekb, {.v = (int []){ -40, 0, 0, 0 }}},
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, moveresizekb, {.v = (int []){ 0, 0, 0, 40 }}},
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, moveresizekb, {.v = (int []){ 0, 0, 0, -40 }}},
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, moveresizekb, {.v = (int []){ 0, 0, 40, 0 }}},
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, moveresizekb, {.v = (int []){ 0, 0, -40, 0 }}},
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c
index 44f3ad9..a6450f5 100644
--- a/dwl.c
+++ b/dwl.c
@@ -336,6 +336,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
+static void moveresizekb(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -2760,6 +2761,28 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
+void
+moveresizekb(const Arg *arg)
+{
+ Client *c = focustop(selmon);
+ Monitor *m = selmon;
+
+ if(!(m && arg && arg->v && c)){
+ return;
+ }
+
+ if(!(c->isfloating || m->lt[m->sellt]->arrange == NULL)){
+ return;
+ }
+
+ resize(c, (struct wlr_box){
+ .x = c->geom.x + ((int *)arg->v)[0],
+ .y = c->geom.y + ((int *)arg->v)[1],
+ .width = c->geom.width + ((int *)arg->v)[2],
+ .height = c->geom.height + ((int *)arg->v)[3],
+ }, 1);
+}
+
void
toggletag(const Arg *arg)
{
--
2.54.0