keystroke

Crates.iokeystroke
lib.rskeystroke
version0.0.3
sourcesrc
created_at2015-05-14 04:03:53.180658
updated_at2016-09-28 20:23:28.384158
descriptionSend a string, character, or keystroke event to the system.
homepage
repositoryhttps://github.com/alexchandel/keystroke-rs
max_upload_size
id2104
size7,177
publish (github:rust-numpy:publish)

documentation

README

keystroke-rs

Send a string, character, or keystroke event to the system.

Contributions welcome!

Examples

extern crate keystroke;

// simple
use keystroke::{send_char, send_str};
// medium
use keystroke::{send_key, send_combo, Key, Physical};
// complicated
use keystroke::{press_key, release_key};

fn main() {
	// simple
	send_str("echo FOO bar\n");
	send_char('\n');

	// medium
	send_combo(&[
		Key::Physical(Physical::E), Key::Unicode('c'), Key::Unicode('h'), Key::Unicode('o'),
		Key::Physical(Physical::Return)]);
	send_key(Key::Physical(Physical::Return));

	// complicated
	use Key::{Physical, Unicode};
	use Physical::{E, C, H, O, Return, Shift};
	press_key(Physical(Shift));
	send_combo(&[
		Physical(E), Physical(C), Physical(H), Physical(O)]);
	release_key(Physical(Shift));
	send_key(Physical(Return));
}

TLDR; call keystroke::send_str with a &str.

Development

  • Only has Windows bindings right now. PR's welcome adding linux and macOS!
Commit count: 15

cargo fmt