2019-08-30 17:45:27 +00:00
|
|
|
use std::sync::mpsc;
|
2019-08-30 19:24:03 +00:00
|
|
|
use crate::keyboard::KeyboardInterceptor;
|
|
|
|
use crate::matcher::Matcher;
|
2019-08-31 14:07:45 +00:00
|
|
|
use crate::matcher::scrolling::ScrollingMatcher;
|
|
|
|
use crate::engine::Engine;
|
2019-09-01 20:00:31 +00:00
|
|
|
use crate::config::Configs;
|
2019-09-05 15:20:52 +00:00
|
|
|
use std::thread;
|
2019-08-30 16:32:10 +00:00
|
|
|
|
2019-08-30 17:45:27 +00:00
|
|
|
mod keyboard;
|
2019-08-30 19:24:03 +00:00
|
|
|
mod matcher;
|
2019-08-31 14:07:45 +00:00
|
|
|
mod engine;
|
2019-09-01 20:00:31 +00:00
|
|
|
mod config;
|
2019-08-30 12:33:40 +00:00
|
|
|
|
|
|
|
fn main() {
|
2019-09-04 17:31:02 +00:00
|
|
|
let configs = Configs::load_default();
|
2019-09-05 18:54:19 +00:00
|
|
|
println!("{:#?}", configs);
|
2019-08-30 12:33:40 +00:00
|
|
|
|
2019-08-31 14:07:45 +00:00
|
|
|
let (txc, rxc) = mpsc::channel();
|
2019-08-30 16:32:10 +00:00
|
|
|
|
2019-08-31 14:07:45 +00:00
|
|
|
let sender = keyboard::get_sender();
|
|
|
|
|
2019-09-05 18:54:19 +00:00
|
|
|
let engine = Engine::new(sender, configs.clone());
|
2019-08-31 14:07:45 +00:00
|
|
|
|
2019-09-05 15:20:52 +00:00
|
|
|
thread::spawn(move || {
|
2019-09-05 18:54:19 +00:00
|
|
|
let matcher = ScrollingMatcher::new(configs.clone(), engine);
|
2019-09-05 15:20:52 +00:00
|
|
|
matcher.watch(rxc);
|
|
|
|
});
|
2019-08-31 15:00:23 +00:00
|
|
|
|
2019-09-05 15:20:52 +00:00
|
|
|
let interceptor = keyboard::get_interceptor(txc);
|
|
|
|
interceptor.initialize();
|
|
|
|
interceptor.start();
|
2019-08-30 12:33:40 +00:00
|
|
|
}
|