KeyboardControllable

Trait KeyboardControllable 

Source
pub trait KeyboardControllable {
    // Required methods
    fn key_sequence(&mut self, sequence: &str);
    fn key_down(&mut self, key: Key);
    fn key_up(&mut self, key: Key);
    fn key_click(&mut self, key: Key);

    // Provided methods
    fn key_sequence_parse(&mut self, sequence: &str)
       where Self: Sized { ... }
    fn key_sequence_parse_try(
        &mut self,
        sequence: &str,
    ) -> Result<(), ParseError>
       where Self: Sized { ... }
}
Expand description

Representing an interface and a set of keyboard functions every operating system implementation should implement.

Required Methods§

Source

fn key_sequence(&mut self, sequence: &str)

Types the string

Emits keystrokes such that the given string is inputted.

You can use many unicode here like: ❤️. This works regadless of the current keyboardlayout.

§Example
use noct::*;
let mut noct = Noct::new();
noct.key_sequence("hello world ❤️");
Source

fn key_down(&mut self, key: Key)

presses a given key down

Source

fn key_up(&mut self, key: Key)

release a given key formally pressed down by key_down

Source

fn key_click(&mut self, key: Key)

Much like the key_down and key_up function they’re just invoked consecutively

Provided Methods§

Source

fn key_sequence_parse(&mut self, sequence: &str)
where Self: Sized,

Types the string parsed with DSL.

Typing {+SHIFT}hello{-SHIFT} becomes HELLO. TODO: Full documentation

Examples found in repository?
examples/dsl.rs (line 10)
5fn main() {
6    thread::sleep(Duration::from_secs(2));
7    let mut noct = Noct::new();
8
9    // write text and select all
10    noct.key_sequence_parse("{+UNICODE}{{Hello World!}} ❤️{-UNICODE}{+CTRL}a{-CTRL}");
11}
Source

fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), ParseError>
where Self: Sized,

Same as key_sequence_parse except returns any errors

Implementors§