diff options
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) +} |