diff options
author | tcmal <me@aria.rip> | 2024-07-15 19:19:01 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-07-15 19:25:02 +0100 |
commit | 1a87db1097d9d594c28963c66c627f3c66bcf6de (patch) | |
tree | a93a5a4da14569ede01a0e5cdfaa47d92e784a10 /src/clients/hints.rs | |
parent | 5d2a23a5d618725b75ba77d7185601e5439801c5 (diff) |
set fullscreen based on ewm hints
Diffstat (limited to 'src/clients/hints.rs')
-rw-r--r-- | src/clients/hints.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/clients/hints.rs b/src/clients/hints.rs index fdfbead..39003d2 100644 --- a/src/clients/hints.rs +++ b/src/clients/hints.rs @@ -235,3 +235,24 @@ pub fn is_dialog(conn: &Connection, window: Window) -> bool { && hints.format() == 32 && hints.value::<Atom>()[0] == conn.atoms.net_wm_window_type_dialog } + +/// Check if the given window wants to be fullscreen, using the `NET_WM_STATE` property +pub fn is_fullscreen(conn: &Connection, window: Window) -> bool { + let Ok(hints) = conn.wait_for_reply(conn.send_request(&GetProperty { + window, + delete: false, + property: conn.atoms.net_wm_state, + r#type: x::ATOM_ATOM, + long_offset: 0, + long_length: 9999, + })) else { + return false; + }; + + hints.r#type() == x::ATOM_ATOM + && hints.format() == 32 + && hints + .value::<Atom>() + .iter() + .any(|a| *a == conn.atoms.net_wm_fullscreen) +} |