ipc: update for v0.8 dwl

This commit is contained in:
Frank Honolka 2026-03-19 04:35:29 +00:00
parent 6d4b7d3a57
commit d00a92263c
4 changed files with 43 additions and 44 deletions

View File

@ -1,8 +1,7 @@
From 6c6d655b68770ce82a24fde9b58c4d97b672553a 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
https://codeberg.org/dwl/dwl-patches/wiki/ipc
From 4b38c101a7c0fbdb622da97de89969c3cf59a2e1 Mon Sep 17 00:00:00 2001
From: Frank Honolka <info.snukware@gmail.com>
Date: Wed, 18 Mar 2026 09:11:46 +0000
Subject: [PATCH] adding ipc patch
---
Makefile | 14 +-
@ -13,7 +12,7 @@ Subject: [PATCH] implement dwl-ipc-unstable-v2
create mode 100644 protocols/dwl-ipc-unstable-v2.xml
diff --git a/Makefile b/Makefile
index 8db7409..a79a080 100644
index 578194f..84b2a64 100644
--- a/Makefile
+++ b/Makefile
@@ -17,12 +17,14 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEV
@ -48,22 +47,22 @@ index 8db7409..a79a080 100644
config.h:
cp config.def.h $@
diff --git a/config.def.h b/config.def.h
index 22d2171..1593033 100644
index 8a6eda0..413e6d5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -127,6 +127,7 @@ static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
+ { MODKEY, XKB_KEY_b, togglebar, {0} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
@@ -123,6 +123,7 @@ static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
+ { MODKEY, XKB_KEY_b, togglebar, {0} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
diff --git a/dwl.c b/dwl.c
index 8a587d1..7a4949b 100644
index 101a45f..3bdd57f 100644
--- a/dwl.c
+++ b/dwl.c
@@ -68,6 +68,7 @@
@@ -69,6 +69,7 @@
#include <xcb/xcb_icccm.h>
#endif
@ -71,7 +70,7 @@ index 8a587d1..7a4949b 100644
#include "util.h"
/* macros */
@@ -144,6 +145,12 @@ typedef struct {
@@ -142,6 +143,12 @@ typedef struct {
uint32_t resize; /* configure serial of a pending resize */
} Client;
@ -84,7 +83,7 @@ index 8a587d1..7a4949b 100644
typedef struct {
uint32_t mod;
xkb_keysym_t keysym;
@@ -189,6 +196,7 @@ typedef struct {
@@ -186,6 +193,7 @@ typedef struct {
struct Monitor {
struct wl_list link;
@ -92,8 +91,8 @@ index 8a587d1..7a4949b 100644
struct wlr_output *wlr_output;
struct wlr_scene_output *scene_output;
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
@@ -286,6 +294,17 @@ static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data);
@@ -283,6 +291,17 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir);
+static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id);
@ -110,7 +109,7 @@ index 8a587d1..7a4949b 100644
static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
@@ -338,6 +357,7 @@ static void startdrag(struct wl_listener *listener, void *data);
@@ -335,6 +354,7 @@ static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
@ -118,9 +117,9 @@ index 8a587d1..7a4949b 100644
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -411,6 +431,9 @@ static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
@@ -437,6 +457,9 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_listener start_drag = {.notify = startdrag};
static struct wl_listener new_session_lock = {.notify = locksession};
+static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {.release = dwl_ipc_manager_release, .get_output = dwl_ipc_manager_get_output};
+static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {.release = dwl_ipc_output_release, .set_tags = dwl_ipc_output_set_tags, .set_layout = dwl_ipc_output_set_layout, .set_client_tags = dwl_ipc_output_set_client_tags};
@ -128,7 +127,7 @@ index 8a587d1..7a4949b 100644
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
@@ -703,6 +726,10 @@ cleanupmon(struct wl_listener *listener, void *data)
@@ -731,6 +754,10 @@ cleanupmon(struct wl_listener *listener, void *data)
LayerSurface *l, *tmp;
size_t i;
@ -139,7 +138,7 @@ index 8a587d1..7a4949b 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)
@@ -983,6 +1010,8 @@ createmon(struct wl_listener *listener, void *data)
@@ -1053,6 +1080,8 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
@ -148,7 +147,7 @@ index 8a587d1..7a4949b 100644
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -1334,6 +1363,192 @@ dirtomon(enum wlr_direction dir)
@@ -1400,6 +1429,192 @@ dirtomon(enum wlr_direction dir)
return selmon;
}
@ -341,7 +340,7 @@ index 8a587d1..7a4949b 100644
void
focusclient(Client *c, int lift)
{
@@ -2033,38 +2248,9 @@ void
@@ -2090,38 +2305,9 @@ void
printstatus(void)
{
Monitor *m = NULL;
@ -382,16 +381,16 @@ index 8a587d1..7a4949b 100644
}
void
@@ -2584,6 +2770,8 @@ setup(void)
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
@@ -2648,6 +2834,8 @@ setup(void)
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
+ wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL, dwl_ipc_manager_bind);
+
/* 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 */
@@ -2681,6 +2869,13 @@ tile(Monitor *m)
@@ -2745,6 +2933,13 @@ tile(Monitor *m)
}
}
@ -417,7 +416,7 @@ index 0000000..0a6e7e5
+I would probably just submit raphi's patchset but I don't think that would be polite.
+-->
+<protocol name="dwl_ipc_unstable_v2">
+ <description summary="inter-process-communication about dwl's state">
+ <description summary="inter-proccess-communication about dwl's state">
+ This protocol allows clients to update and get updates from dwl.
+
+ Warning! The protocol described in this file is experimental and
@ -437,7 +436,7 @@ index 0000000..0a6e7e5
+ This interface is exposed as a global in wl_registry.
+
+ Clients can use this interface to get a dwl_ipc_output.
+ After binding the client will receive the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
+ After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
+ The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
+ </description>
+
@ -449,8 +448,8 @@ index 0000000..0a6e7e5
+ </request>
+
+ <request name="get_output">
+ <description summary="get a dwl_ipc_output for a wl_output">
+ Get a dwl_ipc_output for the specified wl_output.
+ <description summary="get a dwl_ipc_outout for a wl_output">
+ Get a dwl_ipc_outout for the specified wl_output.
+ </description>
+ <arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
+ <arg name="output" type="object" interface="wl_output"/>
@ -459,7 +458,7 @@ index 0000000..0a6e7e5
+ <event name="tags">
+ <description summary="Announces tag amount">
+ This event is sent after binding.
+ A roundtrip after binding guarantees the client received all tags.
+ A roundtrip after binding guarantees the client recieved all tags.
+ </description>
+ <arg name="amount" type="uint"/>
+ </event>
@ -467,7 +466,7 @@ index 0000000..0a6e7e5
+ <event name="layout">
+ <description summary="Announces a layout">
+ This event is sent after binding.
+ A roundtrip after binding guarantees the client received all layouts.
+ A roundtrip after binding guarantees the client recieved all layouts.
+ </description>
+ <arg name="name" type="string"/>
+ </event>
@ -491,13 +490,13 @@ index 0000000..0a6e7e5
+ </enum>
+
+ <request name="release" type="destructor">
+ <description summary="release dwl_ipc_output">
+ <description summary="release dwl_ipc_outout">
+ Indicates to that the client no longer needs this dwl_ipc_output.
+ </description>
+ </request>
+
+ <event name="toggle_visibility">
+ <description summary="Toggle client visibility">
+ <description summary="Toggle client visibilty">
+ Indicates the client should hide or show themselves.
+ If the client is visible then hide, if hidden then show.
+ </description>
@ -544,7 +543,7 @@ index 0000000..0a6e7e5
+ <event name="layout_symbol" since="1">
+ <description summary="Update the current layout symbol">
+ Indicates the layout has changed. Since layout symbols are dynamic.
+ As opposed to the zdwl_ipc_manager.layout event, this should take precedence when displaying.
+ As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
+ You can ignore the zdwl_ipc_output.layout event.
+ </description>
+ <arg name="layout" type="string" summary="The new layout"/>
@ -573,7 +572,7 @@ index 0000000..0a6e7e5
+
+ <request name="set_layout">
+ <description summary="Set the layout of this output"/>
+ <arg name="index" type="uint" summary="index of a layout received by dwl_ipc_manager.layout"/>
+ <arg name="index" type="uint" summary="index of a layout recieved by dwl_ipc_manager.layout"/>
+ </request>
+
+ <!-- Version 2 -->
@ -593,5 +592,5 @@ index 0000000..0a6e7e5
+ </interface>
+</protocol>
--
2.43.0
2.53.0