diff options
author | tcmal <me@aria.rip> | 2024-07-04 22:03:16 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-07-04 22:03:16 +0100 |
commit | d147f26efa31cccf162b939c067ab3b6ed2842e2 (patch) | |
tree | df08c22c20460c895f614ba32955d9c83b639a9c /src/clients/hints.rs | |
parent | 7000d2458b7fbe70967c7b97875f305ec1a10589 (diff) |
inherit monitor from parent for transient windows
Diffstat (limited to 'src/clients/hints.rs')
-rw-r--r-- | src/clients/hints.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/clients/hints.rs b/src/clients/hints.rs index bd3ef76..f59794a 100644 --- a/src/clients/hints.rs +++ b/src/clients/hints.rs @@ -102,3 +102,23 @@ impl Ewm { } } } + +/// Gets the `WM_TRANSIENT_FOR` hint set on a window +pub fn transient_for(conn: &Connection, window: Window) -> Option<Window> { + let hints = conn + .wait_for_reply(conn.send_request(&GetProperty { + window, + delete: false, + property: x::ATOM_WM_TRANSIENT_FOR, + r#type: x::ATOM_WINDOW, + long_offset: 0, + long_length: 1, + })) + .ok()?; + + if hints.r#type() != x::ATOM_WINDOW || hints.length() < 1 || hints.format() != 32 { + return None; + } + + Some(hints.value::<Window>()[0]) +} |