From d147f26efa31cccf162b939c067ab3b6ed2842e2 Mon Sep 17 00:00:00 2001 From: tcmal Date: Thu, 4 Jul 2024 22:03:16 +0100 Subject: inherit monitor from parent for transient windows --- src/clients/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/clients/mod.rs') diff --git a/src/clients/mod.rs b/src/clients/mod.rs index 4b5754b..fe0a4d3 100644 --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -173,8 +173,12 @@ impl ClientState { /// Start managing the given window, adding it to the client list and ensuring its configuration is valid. pub fn manage(&mut self, conn: &Connection<'_>, window: Window) { - // TODO: inherit from parent if window is transient - let mon = self.focused_mon(); + let mut mon = self.focused_mon(); + if let Some(parent) = hints::transient_for(conn, window) { + if let Some((parent_mon, _)) = self.find_client_pos(parent) { + mon = parent_mon; + } + } let Ok(geom) = conn.wait_for_reply(conn.send_request(&GetGeometry { drawable: Drawable::Window(window), @@ -194,6 +198,7 @@ impl ClientState { } = self.mons[mon].screen_info; let c = &mut self.mons[mon].clients[0]; + #[allow(clippy::cast_sign_loss)] c.set_geom( conn, geom.x(), -- cgit v1.2.3