From 1a87db1097d9d594c28963c66c627f3c66bcf6de Mon Sep 17 00:00:00 2001 From: tcmal Date: Mon, 15 Jul 2024 19:19:01 +0100 Subject: set fullscreen based on ewm hints --- src/clients/hints.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/clients/hints.rs') 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::()[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::() + .iter() + .any(|a| *a == conn.atoms.net_wm_fullscreen) +} -- cgit v1.2.3