mirror of
https://github.com/tiyn/dwl.git
synced 2026-01-11 17:39:45 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7faae9dfcf |
36
attachtop.patch
Normal file
36
attachtop.patch
Normal 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
|
||||||
|
|
||||||
@@ -34,7 +34,6 @@ static const Layout layouts[] = {
|
|||||||
{ "[]=", tile },
|
{ "[]=", tile },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
{ "[D]", deck },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* monitors */
|
/* monitors */
|
||||||
@@ -140,7 +139,6 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XKB_KEY_r, setlayout, {.v = &layouts[3]} },
|
|
||||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
|
|||||||
87
deck.patch
87
deck.patch
@@ -1,87 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
50
dwl.c
50
dwl.c
@@ -271,7 +271,6 @@ static void createpopup(struct wl_listener *listener, void *data);
|
|||||||
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||||
static void cursorframe(struct wl_listener *listener, void *data);
|
static void cursorframe(struct wl_listener *listener, void *data);
|
||||||
static void cursorwarptohint(void);
|
static void cursorwarptohint(void);
|
||||||
static void deck(Monitor *m);
|
|
||||||
static void destroydecoration(struct wl_listener *listener, void *data);
|
static void destroydecoration(struct wl_listener *listener, void *data);
|
||||||
static void destroydragicon(struct wl_listener *listener, void *data);
|
static void destroydragicon(struct wl_listener *listener, void *data);
|
||||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
||||||
@@ -1235,42 +1234,6 @@ 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);
|
|
||||||
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "%d", n-1);
|
|
||||||
if (c == focustop(m))
|
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
destroydecoration(struct wl_listener *listener, void *data)
|
destroydecoration(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -1812,7 +1775,18 @@ 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);
|
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);
|
wl_list_insert(&fstack, &c->flink);
|
||||||
|
|
||||||
/* Set initial monitor, tags, floating status, and focus:
|
/* Set initial monitor, tags, floating status, and focus:
|
||||||
|
|||||||
Reference in New Issue
Block a user