Skip to main content

MacBackend

Struct MacBackend 

Source
pub struct MacBackend { /* private fields */ }
Available on macOS only.
Expand description

The macOS Backend.

Requires macOS 14 or later, and the Accessibility and Screen Recording permissions for the host process (usually the terminal or app that runs your binary).

Implementations§

Source§

impl MacBackend

Source

pub fn new() -> Result<Self>

Creates the backend. Never fails; missing permissions surface on first use.

§Errors

Infallible today; the Result keeps the signature uniform across platforms.

Trait Implementations§

Source§

impl Backend for MacBackend

Source§

type Handle = MacElement

Handle to a live accessibility element (e.g. AXUIElement, IUIAutomationElement).
Source§

fn list_apps(&self) -> Result<Vec<AppInfo>>

Running apps plus installed apps the user can launch. Read more
Source§

fn launch_app(&self, app: &AppInfo) -> Result<AppInfo>

Starts app without bringing it to the foreground and returns its running record. Read more
Source§

fn permissions(&self) -> Permissions

Permissions currently held by this process.
Source§

fn request_permissions(&self) -> Permissions

Asks the OS to prompt the user for missing permissions, then reports the current state.
Source§

fn list_windows(&self, app: &AppInfo) -> Result<Vec<WindowInfo>>

The app’s windows, front to back where the platform knows the order. Each one with an id can be passed back as CaptureRequest::window. Read more
Source§

fn capture( &self, app: &AppInfo, request: &CaptureRequest, ) -> Result<Capture<MacElement>>

Captures the app’s current window, or the one CaptureRequest::window names. Read more
Source§

fn perform_action(&self, element: &MacElement, action: &str) -> Result<()>

Invokes a named accessibility action (as listed in Action::name). Read more
Source§

fn set_value(&self, element: &MacElement, value: &str) -> Result<()>

Writes an element’s value. Read more
Source§

fn value(&self, element: &MacElement) -> Result<Option<String>>

Reads an element’s full, untruncated value. Read more
Source§

fn select_text( &self, element: &MacElement, value: &str, range: Range<usize>, ) -> Result<()>

Selects range (byte offsets into value, the element’s current value). An empty range places the caret. Read more
Source§

fn insert_text(&self, app: &AppInfo, text: &str) -> Result<bool>

Inserts text at the caret of the focused element without synthesizing keystrokes. Returns Ok(false) when the focused element does not support it, so the caller can fall back to Backend::type_text. Read more
Source§

fn click( &self, target: InputTarget<'_>, point: Point, button: MouseButton, count: u32, ) -> Result<()>

Clicks count times at a screen point. Read more
Source§

fn scroll( &self, target: InputTarget<'_>, point: Point, dx: f64, dy: f64, ) -> Result<()>

Scrolls at a screen point by (dx, dy) points; positive dy reveals content below. Read more
Source§

fn drag(&self, target: InputTarget<'_>, from: Point, to: Point) -> Result<()>

Presses the primary button at from, moves to to, and releases. Read more
Source§

fn type_text(&self, target: InputTarget<'_>, text: &str) -> Result<()>

Types literal text. Read more
Source§

fn press_key(&self, target: InputTarget<'_>, chord: &KeyChord) -> Result<()>

Presses and releases a key chord. Read more
Source§

impl Debug for MacBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MacBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.