Compare commits

..
3 Commits
5 changed files with 148 additions and 48 deletions
+3 -2
View File
@@ -2,8 +2,9 @@
Focus the window to the left, right, above or below the current focused window
### Download
- [git branch](https://codeberg.org/ldev105/dwl/src/branch/focusdir)
- [2023-01-22](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/focusdir/focusdir.patch)
- [0.9](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/focusdir/focusdir-0.9.patch.patch)
- [main 2026-09-29](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/focusdir/focusdir-wlroots-next-4fd683c.patch)
### Authors
- [pi66](https://codeberg.org/pi66)
- [ldev105](https://codeberg.org/ldev105)
@@ -1,7 +1,7 @@
From a0e71a687b7fcaebdaf1da80c09bf5563bff46b1 Mon Sep 17 00:00:00 2001
From: ldev <ldev@ldev.eu.org>
Date: Mon, 12 Feb 2024 21:50:24 +0100
Subject: [PATCH] focusdir
From 2b10cf7ae87f119627260ec5a17147593697b734 Mon Sep 17 00:00:00 2001
From: pi66 <pixel2176@proton.me>
Date: Tue, 29 Sep 2026 12:15:43 +0100
Subject: [PATCH] focusdir: update for dwl v0.9 and wlroots-next-4fd683c
---
config.def.h | 4 ++++
@@ -9,10 +9,10 @@ Subject: [PATCH] focusdir
2 files changed, 49 insertions(+)
diff --git a/config.def.h b/config.def.h
index 9009517..2a1a82e 100644
index 13c5322..d81f9cd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -124,6 +124,10 @@ static const Key keys[] = {
@@ -125,6 +125,10 @@ static const Key keys[] = {
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
@@ -24,7 +24,7 @@ index 9009517..2a1a82e 100644
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
diff --git a/dwl.c b/dwl.c
index bf02a6d..64d5de7 100644
index 4cfd0fd..acab367 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1,6 +1,7 @@
@@ -34,29 +34,30 @@ index bf02a6d..64d5de7 100644
+#include <limits.h>
#include <getopt.h>
#include <libinput.h>
#include <linux/input-event-codes.h>
@@ -268,6 +269,7 @@ static Monitor *dirtomon(enum wlr_direction dir);
#include <limits.h>
@@ -306,6 +307,7 @@ static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static void focusdir(const Arg *arg);
static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data);
static void handlesig(int signo);
@@ -1271,6 +1273,49 @@ focusstack(const Arg *arg)
static void gpureset(struct wl_listener *listener, void *data);
@@ -1624,6 +1626,49 @@ focusstack(const Arg *arg)
focusclient(c, 1);
}
+void focusdir(const Arg *arg)
+{
+ /* Focus the left, right, up, down client relative to the current focused client on selmon */
+ int dist=INT_MAX;
+ Client *c, *sel = focustop(selmon);
+ Client *newsel = NULL;
+ int newdist=INT_MAX;
+
+ if (!sel || sel->isfullscreen)
+ return;
+
+ int dist=INT_MAX;
+ Client *newsel = NULL;
+ int newdist=INT_MAX;
+ wl_list_for_each(c, &clients, link) {
+ if (!VISIBLEON(c, selmon))
+ continue; /* skip non visible windows */
@@ -89,10 +90,9 @@ index bf02a6d..64d5de7 100644
+ }
+}
+
+
/* 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
* only return that client */
--
2.43.0
2.55.0
@@ -0,0 +1,98 @@
From 552608256fdd2fcc0a0654651b5ee345b6fb9718 Mon Sep 17 00:00:00 2001
From: pi66 <pixel2176@proton.me>
Date: Tue, 29 Sep 2026 12:09:59 +0100
Subject: [PATCH] focusdir: update for dwl v0.9 and wlroots-next-4fd683c
---
config.def.h | 4 ++++
dwl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/config.def.h b/config.def.h
index a4019d3..c36bd6e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -125,6 +125,10 @@ static const Key keys[] = {
{ 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|WLR_MODIFIER_CTRL, XKB_KEY_h, focusdir, {.ui = 0} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_l, focusdir, {.ui = 1} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, focusdir, {.ui = 2} },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, focusdir, {.ui = 3} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
diff --git a/dwl.c b/dwl.c
index 26fb3a0..4f66a63 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1,6 +1,7 @@
/*
* See LICENSE file for copyright and license details.
*/
+#include <limits.h>
#include <getopt.h>
#include <libinput.h>
#include <limits.h>
@@ -308,6 +309,7 @@ static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, LayerSurface *l, int lift);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static void focusdir(const Arg *arg);
static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data);
static void gpureset(struct wl_listener *listener, void *data);
@@ -1632,6 +1634,49 @@ focusstack(const Arg *arg)
focusclient(c, NULL, 1);
}
+void focusdir(const Arg *arg)
+{
+ /* Focus the left, right, up, down client relative to the current focused client on selmon */
+ int dist=INT_MAX;
+ Client *c, *sel = focustop(selmon);
+ Client *newsel = NULL;
+ int newdist=INT_MAX;
+
+ if (!sel || sel->isfullscreen)
+ return;
+
+ wl_list_for_each(c, &clients, link) {
+ if (!VISIBLEON(c, selmon))
+ continue; /* skip non visible windows */
+
+ if (arg->ui == 0 && sel->geom.x <= c->geom.x) {
+ /* Client isn't on our left */
+ continue;
+ }
+ if (arg->ui == 1 && sel->geom.x >= c->geom.x) {
+ /* Client isn't on our right */
+ continue;
+ }
+ if (arg->ui == 2 && sel->geom.y <= c->geom.y) {
+ /* Client isn't above us */
+ continue;
+ }
+ if (arg->ui == 3 && sel->geom.y >= c->geom.y) {
+ /* Client isn't below us */
+ continue;
+ }
+
+ dist=abs(sel->geom.x-c->geom.x)+abs(sel->geom.y-c->geom.y);
+ if (dist < newdist){
+ newdist = dist;
+ newsel=c;
+ }
+ }
+ if (newsel != NULL){
+ focusclient(newsel, NULL, 1);
+ }
+}
+
/* We probably should change the name of this: it sounds like it
* will focus the topmost client of this mon, when actually will
* only return that client */
--
2.55.0
+2 -1
View File
@@ -6,7 +6,7 @@ KNOWN BUGS:
### Download
- [git branch](https://codeberg.org/fauxmight/dwl/src/branch/touch-input)
- [touch-input-wlroots-next-f1675a4.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/touch-input/touch-input-wlroots-next-f1675a4.patch)
- [touch-input-wlroots-next-4fd683c.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/touch-input/touch-input-wlroots-next-4fd683c.patch)
- [touch-input-0.8.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/touch-input/touch-input-0.8.patch)
- [touch-input-0.9.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/touch-input/touch-input-0.9.patch)
- [touch-input-0.8-osu-ver.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/touch-input/touch-input-0.8-osu-ver.patch)
@@ -22,6 +22,7 @@ KNOWN BUGS:
### Changelog
- 2026-09-29 Update patch for dwl wlroots-next branch commit 4fd683c
- 2026-09-25 Update patch for dwl v0.9 and dwl wlroots-next branch commit f1675a4
- 2026-06-15 Add support for osu! fullscreen touch input (fix cursor stuck issue)
- 2026-02-26 Update patch for dwl v0.8 and dwl wlroots-next branch commit f4249db
@@ -1,14 +1,14 @@
From 22342273e7dfb9af1e7e4b19b9b64ccc05a70023 Mon Sep 17 00:00:00 2001
From 5501a1138fb1be89fd3fb21e3d8ac8cfbc6ff38e Mon Sep 17 00:00:00 2001
From: pi66 <pixel2176@proton.me>
Date: Fri, 25 Sep 2026 19:59:48 +0100
Subject: [PATCH] fix: add missing touches list declaration
Date: Tue, 29 Sep 2026 11:46:55 +0100
Subject: [PATCH] touch-input: update for wlroots-next-4fd683c
---
dwl.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 158 insertions(+)
diff --git a/dwl.c b/dwl.c
index 4cfd0fd..e6d8433 100644
index 26fb3a0..3c60d4d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -58,6 +58,7 @@
@@ -32,7 +32,7 @@ index 4cfd0fd..e6d8433 100644
typedef struct {
/* Must keep this field first */
unsigned int type; /* LayerShell */
@@ -289,7 +296,9 @@ static void createnotify(struct wl_listener *listener, void *data);
@@ -291,7 +298,9 @@ static void createnotify(struct wl_listener *listener, void *data);
static void createpointer(struct wlr_pointer *pointer);
static void createpointerconstraint(struct wl_listener *listener, void *data);
static void createpopup(struct wl_listener *listener, void *data);
@@ -42,7 +42,7 @@ index 4cfd0fd..e6d8433 100644
static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void);
static void destroydecoration(struct wl_listener *listener, void *data);
@@ -359,6 +368,10 @@ static void togglefloating(const Arg *arg);
@@ -361,6 +370,10 @@ static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -53,7 +53,7 @@ index 4cfd0fd..e6d8433 100644
static void unlocksession(struct wl_listener *listener, void *data);
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
static void unmapnotify(struct wl_listener *listener, void *data);
@@ -429,6 +442,7 @@ static struct wlr_output_layout *output_layout;
@@ -430,6 +443,7 @@ static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
@@ -61,7 +61,7 @@ index 4cfd0fd..e6d8433 100644
static int consumed[KEY_MAX + 1];
/* global event handlers */
@@ -459,6 +473,10 @@ static struct wl_listener request_set_sel = {.notify = setsel};
@@ -460,6 +474,10 @@ static struct wl_listener request_set_sel = {.notify = setsel};
static struct wl_listener request_set_cursor_shape = {.notify = setcursorshape};
static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_listener start_drag = {.notify = startdrag};
@@ -72,7 +72,7 @@ index 4cfd0fd..e6d8433 100644
static struct wl_listener new_session_lock = {.notify = locksession};
static struct wl_listener new_foreign_toplevel_capture_request = {.notify = capturerequest};
@@ -874,6 +892,10 @@ cleanuplisteners(void)
@@ -873,6 +891,10 @@ cleanuplisteners(void)
wl_list_remove(&request_set_cursor_shape.link);
wl_list_remove(&request_start_drag.link);
wl_list_remove(&start_drag.link);
@@ -83,7 +83,7 @@ index 4cfd0fd..e6d8433 100644
wl_list_remove(&new_session_lock.link);
wl_list_remove(&new_foreign_toplevel_capture_request.link);
#ifdef XWAYLAND
@@ -1297,6 +1319,16 @@ createpopup(struct wl_listener *listener, void *data)
@@ -1306,6 +1328,16 @@ createpopup(struct wl_listener *listener, void *data)
LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup);
}
@@ -100,7 +100,7 @@ index 4cfd0fd..e6d8433 100644
void
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
{
@@ -1703,6 +1735,9 @@ inputdevice(struct wl_listener *listener, void *data)
@@ -1711,6 +1743,9 @@ inputdevice(struct wl_listener *listener, void *data)
case WLR_INPUT_DEVICE_POINTER:
createpointer(wlr_pointer_from_input_device(device));
break;
@@ -110,7 +110,7 @@ index 4cfd0fd..e6d8433 100644
default:
/* TODO handle other input device types */
break;
@@ -1715,6 +1750,8 @@ inputdevice(struct wl_listener *listener, void *data)
@@ -1723,6 +1758,8 @@ inputdevice(struct wl_listener *listener, void *data)
caps = WL_SEAT_CAPABILITY_POINTER;
if (!wl_list_empty(&kb_group->wlr_group->devices))
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
@@ -119,7 +119,7 @@ index 4cfd0fd..e6d8433 100644
wlr_seat_set_capabilities(seat, caps);
}
@@ -2781,6 +2818,13 @@ setup(void)
@@ -2799,6 +2836,13 @@ setup(void)
wl_signal_add(&cursor->events.axis, &cursor_axis);
wl_signal_add(&cursor->events.frame, &cursor_frame);
@@ -133,7 +133,7 @@ index 4cfd0fd..e6d8433 100644
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
wl_signal_add(&cursor_shape_mgr->events.request_set_shape, &request_set_cursor_shape);
@@ -2957,6 +3001,120 @@ toggleview(const Arg *arg)
@@ -2975,6 +3019,120 @@ toggleview(const Arg *arg)
printstatus();
}
@@ -168,7 +168,7 @@ index 4cfd0fd..e6d8433 100644
+ /* Find the client under the pointer and send the event along. */
+ xytonode(lx, ly, &surface, &c, NULL, &sx, &sy);
+ if (sloppyfocus)
+ focusclient(c, 0);
+ focusclient(c, NULL, 0);
+
+ if (surface != NULL) {
+ serial = wlr_seat_touch_notify_down(seat, surface, event->time_msec, event->touch_id, sx, sy);
@@ -238,11 +238,11 @@ index 4cfd0fd..e6d8433 100644
+
+ if (c != NULL && surface != NULL) {
+ if (sloppyfocus)
+ focusclient(c, 0);
+ focusclient(c, NULL, 0);
+ wlr_seat_touch_point_focus(seat, surface, event->time_msec, event->touch_id, sx, sy);
+ } else {
+ if (sloppyfocus)
+ focusclient(NULL, 0);
+ focusclient(NULL, NULL, 0);
+ wlr_seat_touch_point_clear_focus(seat, event->time_msec, event->touch_id);
+ }
+ wlr_seat_touch_notify_motion(seat, event->time_msec, event->touch_id, sx, sy);