From c70505d7c7b7b48600f273357694b56ccf5d2a15 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Fri, 23 May 2025 11:41:09 +0000 Subject: Initial commit --- dwl-patches/patches/moveresizekb/README.md | 20 +++++++ .../patches/moveresizekb/moveresizekb.patch | 70 ++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 dwl-patches/patches/moveresizekb/README.md create mode 100644 dwl-patches/patches/moveresizekb/moveresizekb.patch (limited to 'dwl-patches/patches/moveresizekb') diff --git a/dwl-patches/patches/moveresizekb/README.md b/dwl-patches/patches/moveresizekb/README.md new file mode 100644 index 0000000..0c53caf --- /dev/null +++ b/dwl-patches/patches/moveresizekb/README.md @@ -0,0 +1,20 @@ +### Description +This allows the user to change size and placement of floating windows using only the keyboard, default keybindings: + +| Keybinding | Action | +| :--- | :--- | +| MODKEY + Up | move 40px up | +| MODKEY + Down | move 40px down | +| MODKEY + Left | move 40px left | +| MODKEY + Right | move 40px right | +| MODKEY + Shift + Up | shrink height 40px | +| MODKEY + Shift + Down | grow height 40px | +| MODKEY + Shift + Left | shrink width 40px | +| MODKEY + Shift + Right | grow width 40px | + +### Download +- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/moveresizekb) +- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/moveresizekb/moveresizekb.patch) + +### Authors +- [wochap](https://codeberg.org/wochap) diff --git a/dwl-patches/patches/moveresizekb/moveresizekb.patch b/dwl-patches/patches/moveresizekb/moveresizekb.patch new file mode 100644 index 0000000..aeb1e5e --- /dev/null +++ b/dwl-patches/patches/moveresizekb/moveresizekb.patch @@ -0,0 +1,70 @@ +From c8af428f964679089599e4ffbe7d28d08a4e875f Mon Sep 17 00:00:00 2001 +From: wochap +Date: Tue, 5 Mar 2024 23:42:55 -0500 +Subject: [PATCH] implement keybindings to move and resize focused floating + window + +--- + config.def.h | 8 ++++++++ + dwl.c | 19 +++++++++++++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/config.def.h b/config.def.h +index db0babc..d0570b8 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -135,6 +135,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 ef27a1d..251472b 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -313,6 +313,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); +@@ -2454,6 +2455,24 @@ 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 && c->isfloating)) { ++ 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.42.0 + -- cgit v1.2.3