espanso/src/main.rs

33 lines
961 B
Rust
Raw Normal View History

use std::sync::mpsc;
2019-08-30 19:24:03 +00:00
use crate::keyboard::KeyboardInterceptor;
use crate::matcher::Matcher;
2019-08-31 15:00:23 +00:00
use crate::matcher::Match;
use crate::matcher::scrolling::ScrollingMatcher;
use crate::engine::Engine;
2019-08-30 16:32:10 +00:00
mod keyboard;
2019-08-30 19:24:03 +00:00
mod matcher;
mod engine;
2019-08-30 12:33:40 +00:00
fn main() {
println!("espanso is running!");
2019-08-30 12:33:40 +00:00
let (txc, rxc) = mpsc::channel();
2019-08-30 16:32:10 +00:00
let interceptor = keyboard::get_interceptor(txc);
2019-08-30 19:24:03 +00:00
interceptor.initialize();
interceptor.start();
2019-08-30 16:32:10 +00:00
let sender = keyboard::get_sender();
let engine = Engine::new(&sender);
let matches = vec![Match{trigger:"e'".to_owned(), result: "è".to_owned()},
2019-09-01 18:46:46 +00:00
Match{trigger:"e/".to_owned(), result: "é".to_owned()},
Match{trigger:":lol".to_owned(), result: "😂".to_owned()},
2019-09-01 18:46:46 +00:00
Match{trigger:":llol".to_owned(), result: "😂😂😂😂😂".to_owned()},
];
2019-08-31 15:00:23 +00:00
let mut matcher = ScrollingMatcher::new(&matches, &engine);
matcher.watch(&rxc);
2019-08-30 12:33:40 +00:00
}