feat(snippets): initialize snippet db

This commit creates the initial backend infrastructure for the snippets feature. It sets up the core data model, a dedicated `SnippetManager` for database interactions using `rusqlite`, and integrates it into the Tauri application state.
This commit is contained in:
ByteAtATime 2025-06-24 18:46:47 -07:00
parent 21cd217a26
commit 1a2fa36a79
No known key found for this signature in database
4 changed files with 60 additions and 4 deletions

View file

@ -13,12 +13,13 @@ mod quicklinks;
mod snippets;
mod system;
use crate::{app::App, cache::AppCache, snippets::input_manager::EvdevInputManager};
use crate::{app::App, cache::AppCache};
use browser_extension::WsState;
use frecency::FrecencyManager;
use quicklinks::QuicklinkManager;
use selection::get_text;
use snippets::input_manager::InputManager;
use snippets::input_manager::{InputManager, RdevInputManager};
use snippets::manager::SnippetManager;
use std::process::Command;
use std::thread;
use std::time::Duration;
@ -156,7 +157,7 @@ fn setup_global_shortcut(app: &mut tauri::App) -> Result<(), Box<dyn std::error:
fn setup_input_listener() {
thread::spawn(move || {
let manager = EvdevInputManager::new();
let manager = RdevInputManager::new();
let callback = |event| {
println!("[InputManager] Received Key: {:?}", event);
};
@ -245,6 +246,10 @@ pub fn run() {
let frecency_manager = FrecencyManager::new(app.handle().clone())?;
app.manage(frecency_manager);
let snippet_manager = SnippetManager::new(app.handle().clone())?;
snippet_manager.init_db()?;
app.manage(snippet_manager);
setup_background_refresh();
setup_global_shortcut(app)?;
setup_input_listener();