window_getter/
lib.rs

1#![doc = include_str!("../README.md")]
2
3mod bounds;
4mod error;
5pub mod platform_impl;
6mod window;
7mod window_id;
8
9pub use bounds::Bounds;
10pub use error::Error;
11pub use window::Window;
12pub use window_id::WindowId;
13
14/// Retrieves a window by its unique identifier.
15///
16/// # Platform-specific
17/// - **windows:** It will always return [`Ok`].
18pub fn get_window(id: WindowId) -> Result<Option<Window>, Error> {
19    #[cfg(target_os = "macos")]
20    {
21        platform_impl::get_window(*id.platform_window_id())
22    }
23    #[cfg(target_os = "windows")]
24    {
25        Ok(platform_impl::get_window(*id.platform_window_id()))
26    }
27}
28
29/// Retrieves a list of all open windows on the system.
30pub fn get_windows() -> Result<Vec<Window>, Error> {
31    platform_impl::get_windows()
32}