1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Convenience functions for the keyboard functionality in xdotool.
use Output;
use crateKeyboardOption;
use crate;
use crateOptionVec;
use craterun;
/// Type a given keystroke.
/// Generally, any valid X Keysym string will work. Multiple keys are separated by '+'.
/// Aliases exist for "alt", "ctrl", "shift", "super", and "meta" which all map to Foo_L, such as Alt_L and Control_L, etc.
/// In cases where your keyboard doesn't actually have the key you want to type, xdotool will automatically find an unused keycode and use that to type the key.
///
/// # Options
///
/// - `KeyboardOption::Window(String)` Send keystrokes to a specific window id.
/// - `KeyboardOption::ClearModifiers` Clear modifiers before sending keystrokes.
/// - `KeyboardOption::Delay(u32)` Delay between keystrokes. Default is 12ms.
///
/// # Examples
///
/// Send the keystroke ctrl+l then Backspace as separate keystrokes with 200ms delay to the active window:
///
/// ```
/// # use xdotool::command::options;
/// # use xdotool::{keyboard, option_vec, OptionVec};
/// keyboard::send_key("ctrl+l BackSpace", option_vec![
/// options::KeyboardOption::Delay(200)
/// ]);
/// ```
/// Same as [`send_key`](fn.send_key.html), except only keydown (press) events are sent.
/// Same as [`send_key`](fn.send_key.html), except only keyup (release) events are sent.
/// Types as if you had typed it. Supports newlines tabs (ASCII newline and tab).
/// Each keystroke is separated by a delay given by `KeyboardOption::Delay(u32)`.
/// See [`send_key`](fn.send_key.html) for information about possible options and examples.