Replies: 3 comments 1 reply
-
Yeah, good idea. |
Beta Was this translation helpful? Give feedback.
-
I started working on this and I would love some guidance, I've never used xlib before and after a bunch of searching I stumbled across the XRes extension which allows to get the pid and get diff --git a/src/xstate/mod.rs b/src/xstate/mod.rs
index e4e39c46f2..e0f7f66c96 100644
--- a/src/xstate/mod.rs
+++ b/src/xstate/mod.rs
@@ -302,7 +303,33 @@
} else {
Some(parent)
};
- server_state.new_window(e.window(), e.override_redirect(), (&e).into(), parent);
+ let pid = self
+ .connection
+ .wait_for_reply(self.connection.send_request(&xcb::res::QueryClientIds {
+ specs: &[xcb::res::ClientIdSpec {
+ client: e.window().resource_id(),
+ mask: xcb::res::ClientIdMask::LOCAL_CLIENT_PID,
+ }],
+ }))
+ .map(|reply| reply.ids().next().unwrap().value()[0]);
+ let activation_token = if let Ok(pid) = pid {
+ let environ =
+ std::fs::read_to_string(format!("/proc/{pid}/environ")).unwrap();
+ environ
+ .split('\0')
+ .find_map(|line| line.strip_prefix("XDG_ACTIVATION_TOKEN="))
+ .map(ToString::to_string)
+ } else {
+ None
+ };
+ dbg!(&activation_token);
+ server_state.new_window(
+ e.window(),
+ e.override_redirect(),
+ (&e).into(),
+ parent,
+ activation_token,
+ );
}
xcb::Event::X(x::Event::ReparentNotify(e)) => {
debug!("reparent event: {e:?}"); but then I got completely lost in the event code, I'm not sure which type of delegation I should use in the server dispatch,
So I think the nested server doesn't need to implement the protocol, just the xwayland-satellite client. |
Beta Was this translation helpful? Give feedback.
-
I just added an ARCHITECTURE.md: https://github.com/Supreeeme/xwayland-satellite/blob/main/ARCHITECTURE.md Feel free to propose any changes/clarifications. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on xdg activation support, and when starting it took me a while to understand how the different components go together and what server and client referred to in this context, and I had to draw myself this to understand it:
(I don't like mermaid but github has native support for it and it's readable without rendering, alternatively this could be svg or ascii)
I think it would be nice to include this somewhere to make it a bit more approachable to contribute, it's a very low-cost high-value piece of documentation.
I'm not sure where this should go, in the README or somewhere else specifically for contributors. In general I think something like a
ARCHITECTURE.md
is a good idea.Beta Was this translation helpful? Give feedback.
All reactions