Files
dwl-patches/patches/ipc/ipcpertag.patch
T
2026-09-21 21:49:55 +03:00

98 lines
2.2 KiB
Diff

From cfcff31000041511b97c928645f2daef3127ba09 Mon Sep 17 00:00:00 2001
From: julmajustus <julmajustus@tutanota.com>
Date: Mon, 21 Sep 2026 21:41:48 +0300
Subject: [PATCH] ipc: update ipcpertag for v0.9
---
dwl.c | 50 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/dwl.c b/dwl.c
index d24fcb3..b43843e 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1679,28 +1679,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);
@@ -1708,16 +1717,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.55.0