Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Pid unset for xWayland windows. #331

Closed
ConnorWorrell opened this issue Nov 6, 2022 · 4 comments
Closed

Pid unset for xWayland windows. #331

ConnorWorrell opened this issue Nov 6, 2022 · 4 comments
Labels
A: bug Something isn't working

Comments

@ConnorWorrell
Copy link

ConnorWorrell commented Nov 6, 2022

Info

dwl's commit: 8bd3442
wlroots version: 0.15.1

Description

The c->pid value for xwayland windows is always 0.
This interferes with the swallow patch's ability to match by pid.

Here's a hack and slash fix I cooked up, but I'm sure there is a cleaner way to do it:

---
 client.h | 8 ++++++++
 dwl.c    | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/client.h b/client.h
index 49982e0..ecfa5b1 100644
--- a/client.h
+++ b/client.h
@@ -333,3 +333,11 @@ toplevel_from_wlr_layer_surface(struct wlr_surface *s)
 
 	return NULL;
 }
+
+#ifdef XWAYLAND
+static inline int
+client_get_pid(Client *c)
+{
+    return c->surface.xwayland->pid;
+}
+#endif
diff --git a/dwl.c b/dwl.c
index ffcd43f..f1a6a51 100644
--- a/dwl.c
+++ b/dwl.c
@@ -545,7 +545,9 @@ applyrules(Client *c)
 		appid = broken;
 	if (!(title = client_get_title(c)))
 		title = broken;
-
+    if (client_is_x11(c)) {
+        c->pid = client_get_pid(c);
+    }
 	for (r = rules; r < END(rules); r++) {
 		if ((!r->title || strstr(title, r->title))
 				&& (!r->id || strstr(appid, r->id))) {
-- 
@ConnorWorrell ConnorWorrell added the A: bug Something isn't working label Nov 6, 2022
@sevz17
Copy link
Collaborator

sevz17 commented Nov 6, 2022

c->pid is not part of main branch

@sevz17 sevz17 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2022
@ConnorWorrell
Copy link
Author

ConnorWorrell commented Nov 6, 2022

@sevz17

c->pid is not part of main branch

Eventhough c->pid is not used in the main branch, it is provided by Client in the main branch, and it is incorrectly set for xwayland windows.

Since this is provided by the main branch, seems like this should be fixed in the main branch instead of any number of future patches that wish to reference the correct c->pid value.

@sevz17
Copy link
Collaborator

sevz17 commented Nov 7, 2022

@sevz17

c->pid is not part of main branch

Eventhough c->pid is not used in the main branch, it is provided by Client in the main branch, and it is incorrectly set for xwayland windows.

No, it's not provided by Client in the main branch, https://github.com/djpohly/dwl/blob/main/dwl.c#L92-L123

You are probably looking at the main branch of a fork

@ConnorWorrell
Copy link
Author

ConnorWorrell commented Nov 7, 2022

You are probably looking at the main branch of a fork

You're right, I'll send this to the swallow dev.
https://github.com/dm1tz/dwl/commit/17585c99f57856d39fd0d4c489d8bafd103d53f4#commitcomment-89074715

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants