Compare commits

...

4 Commits

Author SHA1 Message Date
André Desgualdo Pereira
237670da97 fix white spaces at the end of some lines 2025-10-19 08:49:13 -03:00
fauxmight
f82f83cd57 Update patches/gridall/winview+gaplessgrid+gridall.diff
Fix minor trailing whitespace issue at multiple lines.
2025-10-19 13:44:20 +02:00
André Desgualdo Pereira
f8e4399bba add gridall patch 2025-10-19 13:44:20 +02:00
Fernando Otto
4263f5be4d Fix: Fixing disconnect with the graphics tablet 2025-10-14 13:13:03 -03:00
5 changed files with 290 additions and 27 deletions

31
patches/gridall/README.md Normal file
View File

@ -0,0 +1,31 @@
### Description
This patch introduces a new way to view and focus on a client:
1. Press the shortcut defined on config.h once to view all windows across all tags using the gaplessgrid layout.
2. Press it again to view the selected window in its original tag using the monocle layout.
The idea is to press a shortcut (e.g., `Mod+g`) to display all windows, then after
selecting one, press it again to jump to that window's tag and focus on it.
This patch depends on two other patches: [gaplessgrid](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/gaplessgrid)
and [winview](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/winview).
If you already have the other two patches added to your `dwl` build, you can simply
apply `gridall.diff`. If not, I've also created a combined patch
that includes winview, gaplessgrid, and gridall `winview+gaplessgrid+gridall.diff`.
Additionally, this patch serves as an example of how to combine two functions
under a single shortcut, allowing users to further customize their `dwl` setup.
**Note:** Sometimes a window may get "lost" in one of the tags. This patch helps
you quickly find and focus on it without having to move it or change its tag.
### Download
- [git branch](https://codeberg.org/Kana/dwl/src/branch/gridall)
- [main gridall 2025-10-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gridall/gridall.diff)
- [main winview+gaplessgrid+gridall 2025-10-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gridall/winview+gaplessgrid+gridall.diff)
### Authors
- [André Desgualdo Pereira](https://codeberg.org/Kana)

View File

@ -0,0 +1,67 @@
diff -up ../dwl_winview_gaplessgrid/config.def.h ./config.def.h
--- ../dwl_winview_gaplessgrid/config.def.h 2025-10-09 09:00:33.058449462 -0300
+++ ./config.def.h 2025-10-09 08:52:57.021707301 -0300
@@ -144,6 +144,7 @@ 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_a, togglegridall, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY, XKB_KEY_o, winview, {0}},
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
diff -up ../dwl_winview_gaplessgrid/dwl.c ./dwl.c
--- ../dwl_winview_gaplessgrid/dwl.c 2025-10-09 09:00:56.123374462 -0300
+++ ./dwl.c 2025-10-09 08:55:16.022929525 -0300
@@ -353,6 +353,7 @@ static Monitor *xytomon(double x, double
static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg);
+static void togglegridall(const Arg *arg);
/* variables */
static pid_t child_pid = -1;
@@ -407,6 +408,7 @@ static struct wlr_output_layout *output_
static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static int togglegridallstate = 0;
/* global event handlers */
static struct wl_listener cursor_axis = {.notify = axisnotify};
@@ -3066,6 +3068,36 @@ winview(const Arg *a) {
return;
}
+void
+togglegridall(const Arg *arg)
+{
+ if (togglegridallstate == 0) {
+ /* hide the statusbar when activating the gridall
+ const char *dwlb_hide_cmd[] = { "dwlb", "-hide", "eDP-1", NULL };
+ if (fork() == 0) {
+ setsid();
+ execvp(dwlb_hide_cmd[0], (char *const *)dwlb_hide_cmd);
+ perror("execvp");
+ _exit(1);
+ } */
+ setlayout(&(const Arg){.v = &layouts[3]});
+ view(&(Arg){.ui = ~0});
+ } else {
+ /*const char *dwlb_show_cmd[] = { "dwlb", "-show", "eDP-1", NULL };*/
+ winview(&(const Arg){0});
+ setlayout(&(const Arg){.v = &layouts[0]});
+ /* show the statusbar again after choosing the client window to focus
+ if (fork() == 0) {
+ setsid();
+ execvp(dwlb_show_cmd[0], (char *const *)dwlb_show_cmd);
+ perror("execvp");
+ _exit(1);
+ } */
+ }
+ togglegridallstate = !togglegridallstate;
+}
+
+
Monitor *
xytomon(double x, double y)
{

View File

@ -0,0 +1,162 @@
diff -up ../../dwl_my_contribution/dwl/config.def.h ./config.def.h
--- ../../dwl_my_contribution/dwl/config.def.h 2025-10-09 08:47:04.900053193 -0300
+++ ./config.def.h 2025-10-09 08:52:57.021707301 -0300
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "###", gaplessgrid },
};
/* monitors */
@@ -139,10 +140,13 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XKB_KEY_g, setlayout, {.v = &layouts[3]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY, XKB_KEY_a, togglegridall, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
+ { MODKEY, XKB_KEY_o, winview, {0}},
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
diff -up ../../dwl_my_contribution/dwl/dwl.c ./dwl.c
--- ../../dwl_my_contribution/dwl/dwl.c 2025-10-09 08:47:04.900053193 -0300
+++ ./dwl.c 2025-10-09 08:55:16.022929525 -0300
@@ -288,6 +288,7 @@ static void focusstack(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);
+static void gaplessgrid(Monitor *m);
static void handlesig(int signo);
static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
@@ -347,10 +348,12 @@ static void urgent(struct wl_listener *l
static void view(const Arg *arg);
static void virtualkeyboard(struct wl_listener *listener, void *data);
static void virtualpointer(struct wl_listener *listener, void *data);
+static void winview(const Arg *a);
static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg);
+static void togglegridall(const Arg *arg);
/* variables */
static pid_t child_pid = -1;
@@ -405,6 +408,7 @@ static struct wlr_output_layout *output_
static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static int togglegridallstate = 0;
/* global event handlers */
static struct wl_listener cursor_axis = {.notify = axisnotify};
@@ -1567,6 +1571,56 @@ handlesig(int signo)
}
void
+gaplessgrid(Monitor *m)
+{
+ unsigned int n = 0, i = 0, ch, cw, cn, rn, rows, cols;
+ Client *c;
+
+ wl_list_for_each(c, &clients, link)
+ if (VISIBLEON(c, m) && !c->isfloating)
+ n++;
+ if (n == 0)
+ return;
+
+ /* grid dimensions */
+ for (cols = 0; cols <= (n / 2); cols++)
+ if ((cols * cols) >= n)
+ break;
+
+ if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
+ cols = 2;
+
+ /* widescreen is better if 3 columns */
+ if (n >= 3 && n <= 6 && (m->w.width / m->w.height) > 1)
+ cols = 3;
+
+ rows = n / cols;
+
+ /* window geometries */
+ cw = cols ? m->w.width / cols : m->w.width;
+ cn = 0; /* current column number */
+ rn = 0; /* current row number */
+ wl_list_for_each(c, &clients, link) {
+ unsigned int cx, cy;
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
+ continue;
+
+ if ((i / rows + 1) > (cols - n % cols))
+ rows = n / cols + 1;
+ ch = rows ? m->w.height / rows : m->w.height;
+ cx = m->w.x + cn * cw;
+ cy = m->w.y + rn * ch;
+ resize(c, (struct wlr_box) { cx, cy, cw, ch}, 0);
+ rn++;
+ if (rn >= rows) {
+ rn = 0;
+ cn++;
+ }
+ i++;
+ }
+}
+
+void
incnmaster(const Arg *arg)
{
if (!arg || !selmon)
@@ -3003,6 +3057,47 @@ virtualpointer(struct wl_listener *liste
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
}
+void
+winview(const Arg *a) {
+ Arg b = {0};
+ Client *sel = focustop(selmon);
+ if(!sel)
+ return;
+ b.ui = sel -> tags;
+ view(&b);
+ return;
+}
+
+void
+togglegridall(const Arg *arg)
+{
+ if (togglegridallstate == 0) {
+ /* hide the statusbar when activating the gridall
+ const char *dwlb_hide_cmd[] = { "dwlb", "-hide", "eDP-1", NULL };
+ if (fork() == 0) {
+ setsid();
+ execvp(dwlb_hide_cmd[0], (char *const *)dwlb_hide_cmd);
+ perror("execvp");
+ _exit(1);
+ } */
+ setlayout(&(const Arg){.v = &layouts[3]});
+ view(&(Arg){.ui = ~0});
+ } else {
+ /*const char *dwlb_show_cmd[] = { "dwlb", "-show", "eDP-1", NULL };*/
+ winview(&(const Arg){0});
+ setlayout(&(const Arg){.v = &layouts[0]});
+ /* show the statusbar again after choosing the client window to focus
+ if (fork() == 0) {
+ setsid();
+ execvp(dwlb_show_cmd[0], (char *const *)dwlb_show_cmd);
+ perror("execvp");
+ _exit(1);
+ } */
+ }
+ togglegridallstate = !togglegridallstate;
+}
+
+
Monitor *
xytomon(double x, double y)
{

View File

@ -1,16 +1,16 @@
From e504dc0fccfc3994962f03dc824d8907c6afc64f Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me>
Date: Sat, 4 May 2024 01:16:12 +0800
Subject: [PATCH] implement wlr-tablet-v2
From 9221dab35862605bd8768652488f8d6211f15a3e Mon Sep 17 00:00:00 2001
From: Fernando Otto <fernandootto369@gmail.com>
Date: Tue, 14 Oct 2025 12:52:30 -0300
Subject: [PATCH] Fixing disconnect with the graphics tablet
---
Makefile | 6 +-
config.def.h | 1 +
dwl.c | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 230 insertions(+), 1 deletion(-)
dwl.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 232 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index f955e7b..ce1b556 100644
index 3358bae..47a2bb2 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ dwl: dwl.o util.o
@ -46,7 +46,7 @@ index 22d2171..3ad98ef 100644
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
diff --git a/dwl.c b/dwl.c
index ac9c36b..b8d129f 100644
index a2711f6..97d3d53 100644
--- a/dwl.c
+++ b/dwl.c
@@ -50,6 +50,9 @@
@ -132,13 +132,15 @@ index ac9c36b..b8d129f 100644
void
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
{
@@ -1321,6 +1362,27 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
@@ -1320,6 +1361,29 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
free(group);
}
+void
+destroytablet(struct wl_listener *listener, void *data)
+{
+ wl_list_remove(&tablet_device_destroy.link);
+ wlr_cursor_detach_input_device(cursor, tablet->wlr_device);
+ tablet = NULL;
+}
+
@ -160,7 +162,7 @@ index ac9c36b..b8d129f 100644
Monitor *
dirtomon(enum wlr_direction dir)
{
@@ -1540,6 +1602,12 @@ inputdevice(struct wl_listener *listener, void *data)
@@ -1539,6 +1603,12 @@ inputdevice(struct wl_listener *listener, void *data)
case WLR_INPUT_DEVICE_POINTER:
createpointer(wlr_pointer_from_input_device(device));
break;
@ -173,7 +175,7 @@ index ac9c36b..b8d129f 100644
default:
/* TODO handle other input device types */
break;
@@ -2567,6 +2635,8 @@ setup(void)
@@ -2566,6 +2636,8 @@ setup(void)
relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy);
@ -182,7 +184,7 @@ index ac9c36b..b8d129f 100644
/*
* Creates a cursor, which is a wlroots utility for tracking the cursor
* image shown on screen.
@@ -2596,6 +2666,10 @@ setup(void)
@@ -2595,6 +2667,10 @@ setup(void)
LISTEN_STATIC(&cursor->events.button, buttonpress);
LISTEN_STATIC(&cursor->events.axis, axisnotify);
LISTEN_STATIC(&cursor->events.frame, cursorframe);
@ -193,7 +195,7 @@ index ac9c36b..b8d129f 100644
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
@@ -2689,6 +2763,156 @@ tagmon(const Arg *arg)
@@ -2688,6 +2764,156 @@ tagmon(const Arg *arg)
setmon(sel, dirtomon(arg->i), 0);
}
@ -351,5 +353,5 @@ index ac9c36b..b8d129f 100644
tile(Monitor *m)
{
--
2.43.0
2.51.0

View File

@ -1,14 +1,13 @@
From dd0abf07f9f3e456428b07e442b87578128da310 Mon Sep 17 00:00:00 2001
From: A Frederick Christensen <dwl@ivories.org>
Date: Sat, 17 May 2025 23:26:15 -0500
Subject: [PATCH] Add tablet input
From f639289974285207be396eac085cce6a316294c0 Mon Sep 17 00:00:00 2001
From: Fernando Otto <fernandootto369@gmail.com>
Date: Tue, 14 Oct 2025 12:20:37 -0300
Subject: [PATCH] Fixing disconnect with the graphics tablet
Signed-off-by: Aldrik Dunbar <aldrik@gmail.com>
---
Makefile | 6 +-
config.def.h | 1 +
dwl.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 244 insertions(+), 1 deletion(-)
dwl.c | 240 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 246 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 578194f..e0d1835 100644
@ -47,7 +46,7 @@ index 95c2afa..1f06356 100644
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
diff --git a/dwl.c b/dwl.c
index 12f441e..1f3b325 100644
index 12f441e..43566fe 100644
--- a/dwl.c
+++ b/dwl.c
@@ -51,6 +51,9 @@
@ -146,13 +145,15 @@ index 12f441e..1f3b325 100644
void
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
{
@@ -1383,6 +1430,27 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
@@ -1383,6 +1430,29 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
free(group);
}
+void
+destroytablet(struct wl_listener *listener, void *data)
+{
+ wl_list_remove(&tablet_device_destroy.link);
+ wlr_cursor_detach_input_device(cursor, tablet->wlr_device);
+ tablet = NULL;
+}
+
@ -174,7 +175,7 @@ index 12f441e..1f3b325 100644
Monitor *
dirtomon(enum wlr_direction dir)
{
@@ -1590,6 +1658,12 @@ inputdevice(struct wl_listener *listener, void *data)
@@ -1590,6 +1660,12 @@ inputdevice(struct wl_listener *listener, void *data)
case WLR_INPUT_DEVICE_POINTER:
createpointer(wlr_pointer_from_input_device(device));
break;
@ -187,7 +188,7 @@ index 12f441e..1f3b325 100644
default:
/* TODO handle other input device types */
break;
@@ -2584,6 +2658,8 @@ setup(void)
@@ -2584,6 +2660,8 @@ setup(void)
relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy);
@ -196,7 +197,7 @@ index 12f441e..1f3b325 100644
/*
* Creates a cursor, which is a wlroots utility for tracking the cursor
* image shown on screen.
@@ -2613,6 +2689,11 @@ setup(void)
@@ -2613,6 +2691,11 @@ setup(void)
wl_signal_add(&cursor->events.button, &cursor_button);
wl_signal_add(&cursor->events.axis, &cursor_axis);
wl_signal_add(&cursor->events.frame, &cursor_frame);
@ -208,7 +209,7 @@ index 12f441e..1f3b325 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);
@@ -2708,6 +2789,163 @@ tagmon(const Arg *arg)
@@ -2708,6 +2791,163 @@ tagmon(const Arg *arg)
setmon(sel, dirtomon(arg->i), 0);
}