#[non_exhaustive]pub enum ComputerAction {
Show 13 variants
Screenshot,
Zoom {
region: [i64; 4],
},
Click {
button: MouseButton,
count: u8,
at: Option<ScreenPoint>,
modifiers: Vec<String>,
},
Drag {
from: ScreenPoint,
to: ScreenPoint,
modifiers: Vec<String>,
},
MoveTo {
at: ScreenPoint,
},
MouseDown,
MouseUp,
CursorPosition,
Scroll {
at: Option<ScreenPoint>,
direction: ScrollDirection,
amount: u32,
modifiers: Vec<String>,
},
Type {
text: String,
},
Key {
keys: String,
repeat: u32,
},
HoldKey {
keys: String,
duration: Duration,
},
Wait {
duration: Duration,
},
}Expand description
One action on a computer.
Key names follow the xdotool convention (Return, ctrl+s, alt+Tab); modifiers are
shift, ctrl, alt and super.
§Example
use adk_core::{ComputerAction, ComputerActionKind, MouseButton, ScreenPoint};
let click = ComputerAction::Click {
button: MouseButton::Left,
count: 1,
at: Some(ScreenPoint::new(10, 20)),
modifiers: vec!["shift".into()],
};
assert_eq!(click.kind(), ComputerActionKind::Click);
assert!(!click.kind().is_observation());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Screenshot
Capture the whole display.
Zoom
Capture [x0, y0, x1, y1] at full resolution, scaled to the screenshot size.
Click
Press and release a button count times, at at or at the cursor.
Drag
Press the left button at from, move to to, release.
MoveTo
Move the cursor.
Fields
at: ScreenPointThe new cursor position.
MouseDown
Press the left button at the cursor.
MouseUp
Release the left button at the cursor.
CursorPosition
Report the cursor position.
Scroll
Scroll amount wheel notches, at at or at the cursor.
Fields
at: Option<ScreenPoint>Where to scroll; the cursor position when None.
direction: ScrollDirectionWhich way.
Type
Type literal text at the keyboard focus.
Key
Press a key or +-joined chord, repeat times.
HoldKey
Hold a key or chord down.
Wait
Pause before the next action.
Implementations§
Source§impl ComputerAction
impl ComputerAction
Sourcepub fn kind(&self) -> ComputerActionKind
pub fn kind(&self) -> ComputerActionKind
The action’s kind.