Updated tmux-borders

This commit is contained in:
kerberoge 2025-06-02 21:23:35 +02:00
parent 585949952f
commit 609c4d63a7
2 changed files with 43 additions and 25 deletions

View File

@ -7,6 +7,7 @@ This patch replaces the window borders of tiled windows with borders that are si
![three clients](screenshot2.png)
### Download
- [git branch](/kerberoge/dwl/src/branch/tmux-borders)
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/tmux-borders/tmux-borders-0.7.patch)
### Authors

View File

@ -1,12 +1,12 @@
From 5129a2fb5d6a1e95a1d57943aeea5ba319949ba1 Mon Sep 17 00:00:00 2001
From 464259603cb3b7346670cc33fd9afa0f8fe0cd49 Mon Sep 17 00:00:00 2001
From: kerberoge <sjoerdenjh@gmail.com>
Date: Sun, 1 Jun 2025 17:03:09 +0200
Subject: [PATCH 1/1] Created tmux-borders patch for stock dwl
---
client.h | 6 ++
dwl.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 274 insertions(+), 22 deletions(-)
dwl.c | 298 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 280 insertions(+), 24 deletions(-)
diff --git a/client.h b/client.h
index 42f225f..007ab7d 100644
@ -26,7 +26,7 @@ index 42f225f..007ab7d 100644
client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
{
diff --git a/dwl.c b/dwl.c
index a2711f6..fa0e1c8 100644
index a2711f6..c092c0e 100644
--- a/dwl.c
+++ b/dwl.c
@@ -191,6 +191,7 @@ struct Monitor {
@ -84,7 +84,14 @@ index a2711f6..fa0e1c8 100644
motionnotify(0, NULL, 0, 0, 0, 0);
checkidleinhibitor(NULL);
}
@@ -725,6 +741,27 @@ cleanupmon(struct wl_listener *listener, void *data)
@@ -721,10 +737,34 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_scene_output_destroy(m->scene_output);
closemon(m);
+ wlr_scene_node_destroy(&m->borders->node);
+ wlr_scene_node_destroy(&m->fborders->node);
+ wlr_scene_node_destroy(&m->uborders->node);
wlr_scene_node_destroy(&m->fullscreen_bg->node);
free(m);
}
@ -112,18 +119,18 @@ index a2711f6..fa0e1c8 100644
void
closemon(Monitor *m)
{
@@ -743,6 +780,10 @@ closemon(Monitor *m)
@@ -743,6 +783,10 @@ closemon(Monitor *m)
selmon = NULL;
}
+ wlr_scene_node_destroy(&m->borders->node);
+ wlr_scene_node_destroy(&m->fborders->node);
+ wlr_scene_node_destroy(&m->uborders->node);
+ destroyborders(m->borders);
+ destroyborders(m->fborders);
+ destroyborders(m->uborders);
+
wl_list_for_each(c, &clients, link) {
if (c->isfloating && c->geom.x > m->m.width)
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
@@ -849,6 +890,19 @@ commitpopup(struct wl_listener *listener, void *data)
@@ -849,6 +893,19 @@ commitpopup(struct wl_listener *listener, void *data)
wl_list_remove(&listener->link);
}
@ -143,7 +150,7 @@ index a2711f6..fa0e1c8 100644
void
createdecoration(struct wl_listener *listener, void *data)
{
@@ -985,6 +1039,9 @@ createmon(struct wl_listener *listener, void *data)
@@ -985,6 +1042,9 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
@ -153,7 +160,7 @@ index a2711f6..fa0e1c8 100644
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -1171,6 +1228,15 @@ cursorwarptohint(void)
@@ -1171,6 +1231,15 @@ cursorwarptohint(void)
}
}
@ -169,7 +176,7 @@ index a2711f6..fa0e1c8 100644
void
destroydecoration(struct wl_listener *listener, void *data)
{
@@ -1336,6 +1402,154 @@ dirtomon(enum wlr_direction dir)
@@ -1336,6 +1405,154 @@ dirtomon(enum wlr_direction dir)
return selmon;
}
@ -324,7 +331,7 @@ index a2711f6..fa0e1c8 100644
void
focusclient(Client *c, int lift)
{
@@ -1366,6 +1580,7 @@ focusclient(Client *c, int lift)
@@ -1366,12 +1583,15 @@ focusclient(Client *c, int lift)
wl_list_insert(&fstack, &c->flink);
selmon = c->mon;
c->isurgent = 0;
@ -332,16 +339,26 @@ index a2711f6..fa0e1c8 100644
client_restack_surface(c);
/* Don't change border color if there is an exclusive focus or we are
@@ -1393,6 +1608,8 @@ focusclient(Client *c, int lift)
* handling a drag operation */
- if (!exclusive_focus && !seat->drag)
+ if (!exclusive_focus && !seat->drag) {
client_set_border_color(c, focuscolor);
+ drawfborders(c->mon);
+ }
}
/* Deactivate old client if focus is changing */
@@ -1389,7 +1609,8 @@ focusclient(Client *c, int lift)
* and probably other clients */
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
client_set_border_color(old_c, bordercolor);
-
+ if (old_c->mon && (!c || c->mon != old_c->mon))
+ destroyborders(old_c->mon->fborders);
client_activate_surface(old, 0);
}
}
+
+ drawfborders(selmon);
printstatus();
if (!c) {
@@ -2193,15 +2410,20 @@ resize(Client *c, struct wlr_box geo, int interact)
@@ -2193,15 +2414,20 @@ resize(Client *c, struct wlr_box geo, int interact)
applybounds(c, bbox);
/* Update scene-graph, including borders */
@ -369,7 +386,7 @@ index a2711f6..fa0e1c8 100644
/* this is a no-op if size hasn't changed */
c->resize = client_set_size(c, c->geom.width - 2 * c->bw,
@@ -2359,8 +2581,13 @@ setlayout(const Arg *arg)
@@ -2359,8 +2585,13 @@ setlayout(const Arg *arg)
return;
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
selmon->sellt ^= 1;
@ -383,7 +400,7 @@ index a2711f6..fa0e1c8 100644
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
arrange(selmon);
printstatus();
@@ -2692,31 +2919,46 @@ void
@@ -2692,31 +2923,46 @@ void
tile(Monitor *m)
{
unsigned int mw, my, ty;
@ -443,7 +460,7 @@ index a2711f6..fa0e1c8 100644
}
i++;
}
@@ -2941,8 +3183,10 @@ urgent(struct wl_listener *listener, void *data)
@@ -2941,8 +3187,10 @@ urgent(struct wl_listener *listener, void *data)
c->isurgent = 1;
printstatus();
@ -455,7 +472,7 @@ index a2711f6..fa0e1c8 100644
}
void
@@ -3147,8 +3391,10 @@ sethints(struct wl_listener *listener, void *data)
@@ -3147,8 +3395,10 @@ sethints(struct wl_listener *listener, void *data)
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
printstatus();