hide-behind-deck

This commit is contained in:
tvtur 2026-04-13 13:41:50 +03:00
parent 4e2adff067
commit 9648e54b86
2 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,12 @@
### Description
Hides all slave clients behind last focused slave in deck layout.
### Dependencies
This patch depends on [hide-behind-monocle](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide-behind-monocle/) and [decklayout](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/decklayout/) patches.
### Download
- [0.8](/dwl/dwl-patches/raw/branch/main/patches/hide-behind-deck/hide-behind-deck.patch)
### Authors - latest at top
- [tvtur](https://codeberg.org/tvtur)

View File

@ -0,0 +1,132 @@
From 295945a45db881627501eb4dbca151aaa6b8b8ed Mon Sep 17 00:00:00 2001
From: tvtur <tur.timothy@gmail.com>
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