Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: Fix process PID to window mapping for X11 (#22348)

timsb46b261f1116
diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs
index ed6467a5e16..40eab6a343b 100644
--- a/crates/gpui/src/platform/linux/x11/window.rs
+++ b/crates/gpui/src/platform/linux/x11/window.rs
@@ -55,6 +55,7 @@ x11rb::atom_manager! {
WM_PROTOCOLS,
WM_DELETE_WINDOW,
WM_CHANGE_STATE,
+ _NET_WM_PID,
_NET_WM_NAME,
_NET_WM_STATE,
_NET_WM_STATE_MAXIMIZED_VERT,
@@ -436,6 +437,18 @@ impl X11WindowState {
// Collect errors during setup, so that window can be destroyed on failure.
let setup_result = maybe!({
+ let pid = std::process::id();
+ check_reply(
+ || "X11 ChangeProperty for _NET_WM_PID failed.",
+ xcb.change_property32(
+ xproto::PropMode::REPLACE,
+ x_window,
+ atoms._NET_WM_PID,
+ xproto::AtomEnum::CARDINAL,
+ &[pid],
+ ),
+ )?;
+
if let Some(size) = params.window_min_size {
let mut size_hints = WmSizeHints::new();
let min_size = (size.width.0 as i32, size.height.0 as i32);