mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-09-11 16:36:26 +00:00
feat(snippets): implement keyboard event handling
This commit sets up the codebase for the Snippets feature. Specifically, it implements an InputManager trait, which listens for, well, inputs. In the future, we will be using this to keep track of the user's keypresses, triggering the text expansion when the trigger word is entered.
This commit is contained in:
parent
28e8ce3e99
commit
21cd217a26
5 changed files with 264 additions and 10 deletions
|
@ -10,13 +10,15 @@ mod filesystem;
|
|||
mod frecency;
|
||||
mod oauth;
|
||||
mod quicklinks;
|
||||
mod snippets;
|
||||
mod system;
|
||||
|
||||
use crate::{app::App, cache::AppCache};
|
||||
use crate::{app::App, cache::AppCache, snippets::input_manager::EvdevInputManager};
|
||||
use browser_extension::WsState;
|
||||
use frecency::FrecencyManager;
|
||||
use quicklinks::QuicklinkManager;
|
||||
use selection::get_text;
|
||||
use snippets::input_manager::InputManager;
|
||||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
@ -152,6 +154,18 @@ fn setup_global_shortcut(app: &mut tauri::App) -> Result<(), Box<dyn std::error:
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn setup_input_listener() {
|
||||
thread::spawn(move || {
|
||||
let manager = EvdevInputManager::new();
|
||||
let callback = |event| {
|
||||
println!("[InputManager] Received Key: {:?}", event);
|
||||
};
|
||||
if let Err(e) = manager.start_listening(Box::new(callback)) {
|
||||
eprintln!("[InputManager] Failed to start: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
|
@ -233,6 +247,7 @@ pub fn run() {
|
|||
|
||||
setup_background_refresh();
|
||||
setup_global_shortcut(app)?;
|
||||
setup_input_listener();
|
||||
|
||||
Ok(())
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue