diff --git a/src-tauri/src/hotkeys.rs b/src-tauri/src/hotkeys.rs index 9d6fa14..208d637 100644 --- a/src-tauri/src/hotkeys.rs +++ b/src-tauri/src/hotkeys.rs @@ -65,8 +65,10 @@ impl HotkeyManager { let hotkey = parse_shortcut(shortcut)?; // Register with global hotkey manager - let hotkey_id = self.manager.register(hotkey).map_err(|e| e.to_string())?; - let id = hotkey_id.id(); // Get the u32 id + self.manager.register(hotkey).map_err(|e| e.to_string())?; + + // Use hash of shortcut as ID (since register returns ()) + let id = Self::hash_shortcut(shortcut); // Store in our map let mut hotkeys = self.hotkeys.lock().unwrap(); @@ -232,3 +234,15 @@ fn parse_key(key: &str) -> Result { Ok(code) } + + +impl HotkeyManager { + fn hash_shortcut(shortcut: &str) -> u32 { + use std::collections::hash_map::DefaultHasher; + use std::hash::{Hash, Hasher}; + + let mut hasher = DefaultHasher::new(); + shortcut.hash(&mut hasher); + hasher.finish() as u32 + } +} diff --git a/src-tauri/src/ocr/engine.rs b/src-tauri/src/ocr/engine.rs index 1d6a7ad..a1a805a 100644 --- a/src-tauri/src/ocr/engine.rs +++ b/src-tauri/src/ocr/engine.rs @@ -1,6 +1,6 @@ use image::{DynamicImage, GrayImage, ImageBuffer, Luma}; use imageproc::contrast::{stretch_contrast, threshold}; -use leptess::TessBaseApi; +use leptess::tesseract::TessBaseApi; use std::collections::HashMap; use tracing::{debug, error, info};