swapandfocusdir: update for 0.8 and abandoned patch adopted by unixchad

This commit is contained in:
nate zhou 2026-03-08 11:23:08 +08:00
parent 898bc7a946
commit 58e371fcb3
No known key found for this signature in database
GPG Key ID: F7476912AA224CAC
2 changed files with 28 additions and 26 deletions

View File

@ -6,9 +6,11 @@ Swap the focused window with the window (no floating) to the left, right, above,
**NOTE:** this patch uses the same algorithm that River uses to select the window in the given direction. **NOTE:** this patch uses the same algorithm that River uses to select the window in the given direction.
### Download ### Download
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/commit/a5f66f3d9cdbfc1a3fd7ae9c0288c35c8ec19479/patches/swapandfocusdir/swapandfocusdir.patch)
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/swapandfocusdir) - [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/swapandfocusdir)
- [2024-07-09](https://codeberg.org/dwl/dwl-patches/raw/commit/13d96b51b54500dd24544cf3a73c61b7a1414bc6/patches/swapandfocusdir/swapandfocusdir.patch) - [2024-07-09](https://codeberg.org/dwl/dwl-patches/raw/commit/13d96b51b54500dd24544cf3a73c61b7a1414bc6/patches/swapandfocusdir/swapandfocusdir.patch)
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swapandfocusdir/swapandfocusdir.patch) - [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swapandfocusdir/swapandfocusdir.patch)
### Authors ### Authors
- [unixchad](https://codeberg.org/unixchad)
- [wochap](https://codeberg.org/wochap) - [wochap](https://codeberg.org/wochap)

View File

@ -1,7 +1,7 @@
From 285470897406b653e77d732a77356aaf9a70b799 Mon Sep 17 00:00:00 2001 From 6972f383921a892e30ac10b42a3d3ce47b2f93e5 Mon Sep 17 00:00:00 2001
From: wochap <gean.marroquin@gmail.com> From: nate zhou <gnuunixchad@outlook.com>
Date: Fri, 5 Jul 2024 12:37:39 -0500 Date: Sat, 28 Feb 2026 20:48:27 +0800
Subject: [PATCH] implement swapandfocusdir Subject: [PATCH] Patch: swapandfocusdir.patch
--- ---
config.def.h | 8 +++ config.def.h | 8 +++
@ -9,29 +9,29 @@ Subject: [PATCH] implement swapandfocusdir
2 files changed, 172 insertions(+) 2 files changed, 172 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 22d2171..724e15e 100644 index 8a6eda0..6e7fc39 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -129,6 +129,14 @@ static const Key keys[] = { @@ -125,6 +125,14 @@ static const Key keys[] = {
{ 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_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, focusdir, {.ui = 0} }, + { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, focusdir, {.ui = 0} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, focusdir, {.ui = 1} }, + { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, focusdir, {.ui = 1} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, focusdir, {.ui = 2} }, + { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, focusdir, {.ui = 2} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, focusdir, {.ui = 3} }, + { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, focusdir, {.ui = 3} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapdir, {.ui = 0} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapdir, {.ui = 0} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapdir, {.ui = 1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapdir, {.ui = 1} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapdir, {.ui = 2} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapdir, {.ui = 2} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapdir, {.ui = 3} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapdir, {.ui = 3} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index dc0437e..844c1f5 100644 index 44f3ad9..1893fbd 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -241,6 +241,11 @@ typedef struct { @@ -239,6 +239,11 @@ typedef struct {
struct wl_listener destroy; struct wl_listener destroy;
} SessionLock; } SessionLock;
@ -51,8 +51,8 @@ index dc0437e..844c1f5 100644
+static void swapdir(const Arg *arg); +static void swapdir(const Arg *arg);
static Client *focustop(Monitor *m); static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data); static void fullscreennotify(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void gpureset(struct wl_listener *listener, void *data);
@@ -1425,6 +1432,163 @@ focusstack(const Arg *arg) @@ -1511,6 +1518,163 @@ focusstack(const Arg *arg)
focusclient(c, 1); focusclient(c, 1);
} }
@ -213,9 +213,9 @@ index dc0437e..844c1f5 100644
+ arrange(selmon); + arrange(selmon);
+} +}
+ +
/* We probably should change the name of this, it sounds like /* We probably should change the name of this: it sounds like it
* will focus the topmost client of this mon, when actually will * will focus the topmost client of this mon, when actually will
* only return that client */ * only return that client */
-- --
2.45.1 2.53.0