From 295945a45db881627501eb4dbca151aaa6b8b8ed Mon Sep 17 00:00:00 2001 From: tvtur Date: Mon, 13 Apr 2026 13:21:13 +0300 Subject: [PATCH] hide-behind-deck --- dwl.c | 54 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/dwl.c b/dwl.c index 5d6db1a..090d44d 100644 --- a/dwl.c +++ b/dwl.c @@ -137,7 +137,7 @@ typedef struct { #endif unsigned int bw; uint32_t tags; - int isfloating, isurgent, isfullscreen; + int isfloating, isurgent, isfullscreen, ismaster; uint32_t resize; /* configure serial of a pending resize */ } Client; @@ -290,7 +290,7 @@ static Client *focustop(Monitor *m, int onlytiled); static void fullscreennotify(struct wl_listener *listener, void *data); static void gpureset(struct wl_listener *listener, void *data); static void handlesig(int signo); -static void hidebehindmonocle(Monitor *m); +static void hidebehind(Monitor *m); static void incnmaster(const Arg *arg); static void inputdevice(struct wl_listener *listener, void *data); static int keybinding(uint32_t mods, xkb_keysym_t sym); @@ -1431,7 +1431,7 @@ focusclient(Client *c, int lift) wl_list_insert(&fstack, &c->flink); selmon = c->mon; c->isurgent = 0; - hidebehindmonocle(c->mon); + hidebehind(c->mon); /* Don't change border color if there is an exclusive focus or we are * handling a drag operation */ @@ -1573,21 +1573,38 @@ handlesig(int signo) } void -hidebehindmonocle(Monitor *m) +hidebehind(Monitor *m) { Client *c; - if (m && m->lt[m->sellt]->arrange == monocle) { - wl_list_for_each(c, &clients, link) { - if (c->mon != m) - continue; - wlr_scene_node_set_enabled(&c->scene->node, VISIBLEON(c, m) && c->isfloating); - } + int check1 = 0; - c = NULL; - - /* Enable top tiled client, fullscreen is considered tiled */ - if ((c = focustop(m, 1))) - wlr_scene_node_set_enabled(&c->scene->node, 1); + if (m) { + if (m && m->lt[m->sellt]->arrange == monocle) { + wl_list_for_each(c, &clients, link) { + if (c->mon != m) + continue; + wlr_scene_node_set_enabled(&c->scene->node, VISIBLEON(c, m) && c->isfloating); + } + c = NULL; + /* Enable top tiled client, fullscreen is considered tiled */ + if ((c = focustop(m, 1))) + wlr_scene_node_set_enabled(&c->scene->node, 1); + } else if (m && m->lt[m->sellt]->arrange == deck) { + wl_list_for_each(c, &fstack, flink) { + if (!VISIBLEON(c, m)) + continue; + if (c->isfloating || c->ismaster) { + wlr_scene_node_set_enabled(&c->scene->node, 1); + continue; + } + if (!check1 && !c->ismaster) { + wlr_scene_node_set_enabled(&c->scene->node, 1); + check1 = 1; + continue; + } + wlr_scene_node_set_enabled(&c->scene->node, 0); + } + } } } @@ -1859,7 +1876,7 @@ monocle(Monitor *m) } if (n) snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); - hidebehindmonocle(m); + hidebehind(m); } void @@ -1871,7 +1888,6 @@ deck(Monitor *m) /* count tiled clients */ wl_list_for_each(c, &clients, link) - /* if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) */ if (VISIBLEON(c, m) && !c->isfloating) n++; @@ -1909,6 +1925,7 @@ deck(Monitor *m) .height = (m->w.height - my) / (MIN(n, m->nmaster) - i) }, 0); my += c->geom.height; + c->ismaster = 1; } else { /* deck clients: overlap in stack area */ resize(c, (struct wlr_box){ @@ -1917,9 +1934,12 @@ deck(Monitor *m) .width = m->w.width - mw, .height = m->w.height }, 0); + c->ismaster = 0; } i++; } + + hidebehind(m); } void -- 2.53.0