ipc: 2024-07-29

add ipcpertag and focus-tagset-output mini-patches
This commit is contained in:
choc 2024-07-29 21:19:10 +08:00
parent 43ee42aeef
commit d235f0f88e
No known key found for this signature in database
4 changed files with 138 additions and 12 deletions

View File

@ -3,9 +3,12 @@ Largely based on [raphi](https://sr.ht/~raphi/)'s [somebar](https://sr.ht/~raphi
Status information to stdout is currently disabled as dwl tends to freeze. For now, `dwlmsg -w` should act as a drop-in replacement.
Note to [pertag](../pertag/) users: apply [this](./ipcpertag.patch) for ipc tagsetting to work as expected
### Download
- [git branch](https://codeberg.org/notchoc/dwl/src/branch/ipc)
- [2024-07-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/ipc/ipc.patch)
- [2024-07-29](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/ipc/ipc.patch) don't focus other outputs (apply [this minipatch](./focus-tagset-output.patch) if you'd prefer that)
- [2024-07-16](https://codeberg.org/dwl/dwl-patches/raw/commit/642b2559d522034785c1c1203c6d426855ec19ca/patches/ipc/ipc.patch)
- [2024-06-30](https://codeberg.org/dwl/dwl-patches/raw/commit/9a751e5020133d3ab9219e68a43109c6f3c931a7/patches/ipc/ipc.patch)
- [2024-06-21](https://codeberg.org/dwl/dwl-patches/raw/commit/f96ee44cbaef06bd38b8fa29ac7ecba8b1b5abd5/patches/ipc/ipc.patch)
- [2024-06-19](https://codeberg.org/dwl/dwl-patches/raw/commit/e69afc7263b8d982a7923e5d4910f2e1f7140bb8/patches/ipc/ipc.patch)

View File

@ -0,0 +1,24 @@
From b65477621f0438b0ed6c405f74c9d15e8fb57e96 Mon Sep 17 00:00:00 2001
From: choc <notchoc@disroot.org>
Date: Mon, 29 Jul 2024 21:26:06 +0800
Subject: [PATCH] ipc: focus set_tag'd output
---
dwl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dwl.c b/dwl.c
index 4a025f0..dcbb063 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1533,6 +1533,7 @@ dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource,
if (!ipc_output)
return;
monitor = ipc_output->mon;
+ selmon = monitor;
if (!newtags || newtags == monitor->tagset[monitor->seltags])
return;
--
2.43.0

View File

@ -1,4 +1,4 @@
From 13efb1a89457df2acd138d671c298e07b3d34683 Mon Sep 17 00:00:00 2001
From 9afb899ea8b63894499d39f4ab7f430eefce5392 Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me>
Date: Mon, 23 Oct 2023 10:35:17 +0800
Subject: [PATCH] implement dwl-ipc-unstable-v2
@ -7,9 +7,9 @@ Subject: [PATCH] implement dwl-ipc-unstable-v2
---
Makefile | 14 +-
config.def.h | 1 +
dwl.c | 258 ++++++++++++++++++++++++++----
dwl.c | 260 ++++++++++++++++++++++++++----
protocols/dwl-ipc-unstable-v2.xml | 181 +++++++++++++++++++++
4 files changed, 417 insertions(+), 37 deletions(-)
4 files changed, 419 insertions(+), 37 deletions(-)
create mode 100644 protocols/dwl-ipc-unstable-v2.xml
diff --git a/Makefile b/Makefile
@ -60,7 +60,7 @@ index 22d2171..1593033 100644
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
diff --git a/dwl.c b/dwl.c
index 5bf995e..3aed40b 100644
index ac9c36b..4a025f0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -67,6 +67,7 @@
@ -139,7 +139,7 @@ index 5bf995e..3aed40b 100644
/* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) {
wl_list_for_each_safe(l, tmp, &m->layers[i], link)
@@ -985,6 +1012,8 @@ createmon(struct wl_listener *listener, void *data)
@@ -986,6 +1013,8 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
@ -148,7 +148,7 @@ index 5bf995e..3aed40b 100644
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -1335,6 +1364,190 @@ dirtomon(enum wlr_direction dir)
@@ -1337,6 +1366,192 @@ dirtomon(enum wlr_direction dir)
return selmon;
}
@ -281,7 +281,8 @@ index 5bf995e..3aed40b 100644
+ return;
+
+ selected_client->tags = newtags;
+ focusclient(focustop(selmon), 1);
+ if (selmon == monitor)
+ focusclient(focustop(monitor), 1);
+ arrange(selmon);
+ printstatus();
+}
@ -325,7 +326,8 @@ index 5bf995e..3aed40b 100644
+ monitor->seltags ^= 1;
+
+ monitor->tagset[monitor->seltags] = newtags;
+ focusclient(focustop(monitor), 1);
+ if (selmon == monitor)
+ focusclient(focustop(monitor), 1);
+ arrange(monitor);
+ printstatus();
+}
@ -339,7 +341,7 @@ index 5bf995e..3aed40b 100644
void
focusclient(Client *c, int lift)
{
@@ -2035,41 +2248,9 @@ void
@@ -2037,41 +2252,9 @@ void
printstatus(void)
{
Monitor *m = NULL;
@ -383,7 +385,7 @@ index 5bf995e..3aed40b 100644
}
void
@@ -2624,6 +2805,8 @@ setup(void)
@@ -2626,6 +2809,8 @@ setup(void)
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
@ -392,7 +394,7 @@ index 5bf995e..3aed40b 100644
/* Make sure XWayland clients don't connect to the parent X server,
* e.g when running in the x11 backend or the wayland backend and the
* compositor has Xwayland support */
@@ -2721,6 +2904,13 @@ tile(Monitor *m)
@@ -2723,6 +2908,13 @@ tile(Monitor *m)
}
}

View File

@ -0,0 +1,97 @@
From c7d77ff4dec1da5a68b4da8aa42d4ed78dc41a00 Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me>
Date: Thu, 14 Mar 2024 11:18:37 +0800
Subject: [PATCH] fix ipc to work with pertag
---
dwl.c | 50 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/dwl.c b/dwl.c
index a1a7809..d86e6e2 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1526,28 +1526,37 @@ void
dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index)
{
DwlIpcOutput *ipc_output;
- Monitor *monitor;
+ Client *c = NULL;
+ Monitor *monitor = NULL;
ipc_output = wl_resource_get_user_data(resource);
if (!ipc_output)
return;
-
monitor = ipc_output->mon;
+
+ if (monitor != selmon)
+ c = focustop(selmon);
+
if (index >= LENGTH(layouts))
return;
- if (index != monitor->lt[monitor->sellt] - layouts)
- monitor->sellt ^= 1;
- monitor->lt[monitor->sellt] = &layouts[index];
- arrange(monitor);
- printstatus();
+ if (c) {
+ monitor = selmon;
+ selmon = ipc_output->mon;
+ }
+ setlayout(&(Arg){.v = &layouts[index]});
+ if (c) {
+ selmon = monitor;
+ focusclient(c, 0);
+ }
}
void
dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset)
{
DwlIpcOutput *ipc_output;
- Monitor *monitor;
+ Client *c = NULL;
+ Monitor *monitor = NULL;
unsigned int newtags = tagmask & TAGMASK;
ipc_output = wl_resource_get_user_data(resource);
@@ -1555,16 +1564,27 @@ dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource,
return;
monitor = ipc_output->mon;
- if (!newtags || newtags == monitor->tagset[monitor->seltags])
+ if (monitor != selmon)
+ c = focustop(selmon);
+
+ if (!newtags)
return;
- if (toggle_tagset)
+
+ /* view toggles seltags for us so we un-toggle it */
+ if (!toggle_tagset) {
monitor->seltags ^= 1;
+ monitor->tagset[monitor->seltags] = 0;
+ }
- monitor->tagset[monitor->seltags] = newtags;
- if (selmon == monitor)
- focusclient(focustop(monitor), 1);
- arrange(monitor);
- printstatus();
+ if (c) {
+ monitor = selmon;
+ selmon = ipc_output->mon;
+ }
+ view(&(Arg){.ui = newtags});
+ if (c) {
+ selmon = monitor;
+ focusclient(c, 0);
+ }
}
void
--
2.43.0