Skip to main content

waterui_cli/apple/
mod.rs

1//! Apple platform support.
2
3/// Apple backend implementation.
4pub mod backend;
5/// Apple device detection and management.
6pub mod device;
7pub(crate) mod dynamic_runtime;
8/// macOS local device gestures and screenshot.
9#[cfg(target_os = "macos")]
10pub mod local;
11/// Non-macOS stub for local Apple automation APIs.
12#[cfg(not(target_os = "macos"))]
13pub mod local {
14    use std::path::Path;
15
16    use eyre::eyre;
17
18    use crate::toolchain::Host;
19
20    /// Information about a macOS window.
21    #[derive(Debug, Clone)]
22    pub struct WindowInfo {
23        /// The window ID (used for screencapture -l).
24        pub window_id: u32,
25        /// The window title/name.
26        pub name: String,
27        /// The owning process ID.
28        pub owner_pid: i32,
29        /// The owning application name.
30        pub owner_name: String,
31        /// Window layer (0 = normal windows).
32        pub layer: i32,
33    }
34
35    fn unsupported() -> eyre::Report {
36        eyre!("apple::local is only supported on macOS")
37    }
38
39    fn unsupported_async<T>() -> impl std::future::Future<Output = eyre::Result<T>> {
40        std::future::ready(Err(unsupported()))
41    }
42
43    /// Stub: local window enumeration is unavailable outside macOS.
44    ///
45    /// # Errors
46    ///
47    /// Always returns an unsupported-platform error.
48    pub fn list_windows_by_pid(_pid: i32) -> eyre::Result<Vec<WindowInfo>> {
49        Err(unsupported())
50    }
51
52    /// Stub: local screenshot is unavailable outside macOS.
53    pub fn screenshot(
54        _host: &Host,
55        _output: &Path,
56    ) -> impl std::future::Future<Output = eyre::Result<()>> {
57        unsupported_async()
58    }
59
60    /// Stub: local screenshot is unavailable outside macOS.
61    pub fn screenshot_bytes(
62        _host: &Host,
63    ) -> impl std::future::Future<Output = eyre::Result<Vec<u8>>> {
64        unsupported_async()
65    }
66
67    /// Stub: local screenshot is unavailable outside macOS.
68    pub fn screenshot_window(
69        _host: &Host,
70        _window_id: u32,
71        _output: &Path,
72    ) -> impl std::future::Future<Output = eyre::Result<()>> {
73        unsupported_async()
74    }
75
76    /// Stub: local screenshot is unavailable outside macOS.
77    pub fn screenshot_window_bytes(
78        _host: &Host,
79        _window_id: u32,
80    ) -> impl std::future::Future<Output = eyre::Result<Vec<u8>>> {
81        unsupported_async()
82    }
83
84    /// Stub: local tap is unavailable outside macOS.
85    pub fn tap(
86        _host: &Host,
87        _x: u32,
88        _y: u32,
89    ) -> impl std::future::Future<Output = eyre::Result<()>> {
90        unsupported_async()
91    }
92
93    /// Stub: local swipe is unavailable outside macOS.
94    pub fn swipe(
95        _host: &Host,
96        _from: (u32, u32),
97        _to: (u32, u32),
98        _duration_ms: Option<u32>,
99    ) -> impl std::future::Future<Output = eyre::Result<()>> {
100        unsupported_async()
101    }
102
103    /// Stub: local text input is unavailable outside macOS.
104    pub fn text(_host: &Host, _input: &str) -> impl std::future::Future<Output = eyre::Result<()>> {
105        unsupported_async()
106    }
107}
108/// Apple platform configuration.
109pub mod physical;
110pub mod platform;
111/// Apple toolchain management.
112pub mod toolchain;