From bf9cfc12ad7bde5cefb3b13ed9af4d6b6ecdc271 Mon Sep 17 00:00:00 2001
From: Deuce <shurd@sasktel.net>
Date: Fri, 2 Jun 2023 22:01:43 -0400
Subject: [PATCH] Set _NET_WM_PID

Seems like a good idea, should allow WMs to kill hung processes and
stuff like that.
---
 src/conio/x_events.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index e647067bac..114db206c1 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -593,6 +593,13 @@ static int init_window()
 		x11.XSetWMProperties(dpy, win, NULL, NULL, 0, 0, NULL, wmhints, classhints);
 		x11.XFree(wmhints);
 	}
+
+	Atom pid_atom = x11.XInternAtom(dpy, "_NET_WM_PID", False);
+	if (pid_atom != None) {
+		unsigned long pid_l = getpid();
+		x11.XChangeProperty(dpy, win, pid_atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid_l, 1);
+	}
+
 	im = x11.XOpenIM(dpy, NULL, "CIOLIB", "CIOLIB");
 	if (im != NULL) {
 		ic = x11.XCreateIC(im, XNClientWindow, win, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL);
-- 
GitLab