take on gaplessgrid and fix minor indentation and typos

This commit is contained in:
André Desgualdo Pereira
2025-10-31 15:53:40 -03:00
parent 7be608e4ed
commit ca2a322d20
3 changed files with 117 additions and 13 deletions
+23 -10
View File
@@ -1,5 +1,15 @@
From 38427b81367e8b4d2aad708a1d463bc793aac65e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Desgualdo=20Pereira?= <desgua@gmail.com>
Date: Fri, 31 Oct 2025 15:46:48 -0300
Subject: [PATCH] take on gaplessgrid and fix minor indentation and typos
---
config.def.h | 2 ++
dwl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/config.def.h b/config.def.h
index 22d2171..014a909 100644
index 95c2afa..2054107 100644
--- a/config.def.h
+++ b/config.def.h
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
@@ -19,10 +29,10 @@ index 22d2171..014a909 100644
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
diff --git a/dwl.c b/dwl.c
index dc0c861..875d8cd 100644
index 12f441e..7ab5323 100644
--- a/dwl.c
+++ b/dwl.c
@@ -292,6 +292,7 @@ static void focusstack(const Arg *arg);
@@ -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);
@@ -30,14 +40,14 @@ index dc0c861..875d8cd 100644
static void handlesig(int signo);
static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
@@ -1510,6 +1511,56 @@ handlesig(int signo)
}
@@ -1566,6 +1567,56 @@ handlesig(int signo)
quit(NULL);
}
+void
+gaplessgrid(Monitor *m)
+{
+ unsigned int n = 0, i = 0, ch, cw, cn, rn, rows, cols;
+ int n = 0, i = 0, ch, cw, cn, rn, rows, cols;
+ Client *c;
+
+ wl_list_for_each(c, &clients, link)
@@ -54,12 +64,12 @@ index dc0c861..875d8cd 100644
+ 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;
+ /* 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 */
@@ -87,3 +97,6 @@ index dc0c861..875d8cd 100644
void
incnmaster(const Arg *arg)
{
--
2.51.0