mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-06 19:24:51 +00:00
revive deck patch
This commit is contained in:
parent
3275b4b909
commit
7da34dd6a7
@ -1,11 +1,8 @@
|
||||
### Description
|
||||
[deck](https://dwm.suckless.org/patches/deck/) is a port of the dwm-layout with the same name. It applies the monocle-layout to the clients in the stack. The master-client is still visible. The stacked clients are like a deck of cards, hence the name.
|
||||
Adds a layout with a monocle layout for clients in the stack (port of the [deck layout for dwm](https://dwm.suckless.org/patches/deck/)); stacked clients are like a deck of cards (see below)
|
||||
|
||||
### Scheme
|
||||
```
|
||||
Showcase
|
||||
|
||||
Tile :
|
||||
Tile:
|
||||
+-----------------+--------+
|
||||
| | |
|
||||
| | S1 |
|
||||
@ -16,7 +13,7 @@ Tile :
|
||||
| | |
|
||||
+-----------------+--------+
|
||||
|
||||
Deck :
|
||||
Deck:
|
||||
+-----------------+--------+
|
||||
| | |
|
||||
| | |
|
||||
@ -29,7 +26,9 @@ Deck :
|
||||
```
|
||||
|
||||
### Download
|
||||
- [2023-07-09](https://github.com/djpohly/dwl/compare/main...PalanixYT:deck.patch)
|
||||
- [git branch](https://codeberg.org/anabasis/dwl/src/branch/deck)
|
||||
- [2024-05-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/deck/deck.patch)
|
||||
|
||||
### Authors
|
||||
- [Palanix](https://github.com/PalanixYT)
|
||||
- [anabasis](https://codeberg.org/anabasis)
|
||||
- [Palanix](https://codeberg.org/Palanix)
|
87
patches/deck/deck.patch
Normal file
87
patches/deck/deck.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From d56f732d3b5bba4ea0bdf56a91d0992b0cb25bfb Mon Sep 17 00:00:00 2001
|
||||
From: anabasis <anabasis@noreply.codeberg.org>
|
||||
Date: Fri, 10 May 2024 13:45:33 -0400
|
||||
Subject: [PATCH] add deck layout
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 36 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8f498d2..9238da0 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -33,6 +33,7 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "[D]", deck },
|
||||
};
|
||||
|
||||
/* monitors */
|
||||
@@ -134,6 +135,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, XKB_KEY_r, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..1a7ce8e 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -267,6 +267,7 @@ static void createpointerconstraint(struct wl_listener *listener, void *data);
|
||||
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||
static void cursorframe(struct wl_listener *listener, void *data);
|
||||
static void cursorwarptohint(void);
|
||||
+static void deck(Monitor *m);
|
||||
static void destroydecoration(struct wl_listener *listener, void *data);
|
||||
static void destroydragicon(struct wl_listener *listener, void *data);
|
||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
||||
@@ -1080,6 +1081,41 @@ cursorwarptohint(void)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+deck(Monitor *m)
|
||||
+{
|
||||
+ unsigned int mw, my;
|
||||
+ int i, n = 0;
|
||||
+ Client *c;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link)
|
||||
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||
+ n++;
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ if (n > m->nmaster)
|
||||
+ mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
|
||||
+ else
|
||||
+ mw = m->w.width;
|
||||
+ i = my = 0;
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
+ continue;
|
||||
+ if (i < m->nmaster) {
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||
+ .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||
+ my += c->geom.height;
|
||||
+ } else {
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y,
|
||||
+ .width = m->w.width - mw, .height = m->w.height}, 0);
|
||||
+ if (c == focustop(m))
|
||||
+ wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
destroydecoration(struct wl_listener *listener, void *data)
|
||||
{
|
||||
--
|
||||
2.45.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user