Add attachtop patch

This commit is contained in:
Sravan Balaji 2024-09-15 23:53:14 -04:00
parent 7adf14be70
commit 1b106aea12
4 changed files with 67 additions and 1 deletions

View File

@ -7,6 +7,7 @@
- [[#welcome][Welcome]] - [[#welcome][Welcome]]
- [[#dwl---dwm-for-wayland][dwl - dwm for Wayland]] - [[#dwl---dwm-for-wayland][dwl - dwm for Wayland]]
- [[#patches][Patches]] - [[#patches][Patches]]
- [[#attach-top][Attach Top]]
- [[#auto-start][Auto Start]] - [[#auto-start][Auto Start]]
- [[#dwl-configuration][dwl Configuration]] - [[#dwl-configuration][dwl Configuration]]
- [[#appearance][Appearance]] - [[#appearance][Appearance]]
@ -46,6 +47,18 @@ See [[./README.md][Upstream README]] for details on project.
* Patches * Patches
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/attachtop][Attach Top]]
This is a port of attachtop patch for dwm: https://dwm.suckless.org/patches/attachtop
New client attaches below the last master/on top of the stack.
Behavior feels very intuitive as it doesn't disrupt existing masters no matter the amount of them, it only pushes the clients in stack down.
#+BEGIN_SRC c :tangle patches.def.h
#define ATTACHTOP_PATCH 1
#+END_SRC
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/autostart][Auto Start]] ** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/autostart][Auto Start]]
Allow dwl to execute commands from autostart array in your config.h file. And when you exit dwl all processes from autostart array will be killed. Allow dwl to execute commands from autostart array in your config.h file. And when you exit dwl all processes from autostart array will be killed.

17
dwl.c
View File

@ -1801,7 +1801,22 @@ mapnotify(struct wl_listener *listener, void *data)
c->geom.height += 2 * c->bw; c->geom.height += 2 * c->bw;
/* Insert this client into client lists. */ /* Insert this client into client lists. */
wl_list_insert(&clients, &c->link); #if ATTACHTOP_PATCH
i = 0;
wl_list_for_each(w, &clients, link) {
if (!VISIBLEON(w, selmon) || c->isfloating)
continue;
p = w;
if (++i >= selmon->nmaster)
break;
}
if (i > 0)
wl_list_insert(&p->link, &c->link);
else
wl_list_insert(&clients, &c->link);
#else
wl_list_insert(&clients, &c->link);
#endif // ATTACHTOP_PATCH
wl_list_insert(&fstack, &c->flink); wl_list_insert(&fstack, &c->flink);
/* Set initial monitor, tags, floating status, and focus: /* Set initial monitor, tags, floating status, and focus:

View File

@ -1 +1,3 @@
#define ATTACHTOP_PATCH 1
#define AUTOSTART_PATCH 1 #define AUTOSTART_PATCH 1

View File

@ -0,0 +1,36 @@
From 42a66d6e06c38e913766ce625f049fdbc3dd0d12 Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Sun, 7 Apr 2024 21:10:17 +0200
Subject: [PATCH] New client are attached on top of the stack
---
dwl.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dwl.c b/dwl.c
index bf763df..c0a3d74 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
c->geom.height += 2 * c->bw;
/* Insert this client into client lists. */
- wl_list_insert(&clients, &c->link);
+ i = 0;
+ wl_list_for_each(w, &clients, link) {
+ if (!VISIBLEON(w, selmon) || c->isfloating)
+ continue;
+ p = w;
+ if (++i >= selmon->nmaster)
+ break;
+ }
+ if (i > 0)
+ wl_list_insert(&p->link, &c->link);
+ else
+ wl_list_insert(&clients, &c->link);
wl_list_insert(&fstack, &c->flink);
/* Set initial monitor, tags, floating status, and focus:
--
2.44.0