Phase 2 complete.

This commit is contained in:
Aodhan Collins
2025-10-06 21:08:25 +01:00
parent 66749a5ce7
commit 8d6a681baa
26 changed files with 3163 additions and 164 deletions

850
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@ tauri-build = { version = "1.5", features = [] }
[dependencies]
dotenvy = "0.15"
tauri = { version = "1.5", features = ["shell-open", "window-all"] }
tauri = { version = "1.5", features = [ "global-shortcut-all", "notification-all", "shell-open", "window-all", "global-shortcut", "notification"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }

View File

@@ -2,6 +2,8 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use serde::Serialize;
use tauri::{Manager, GlobalShortcutManager};
use tauri::api::notification::Notification;
#[derive(Serialize, Clone)]
struct Keys {
@@ -11,19 +13,20 @@ struct Keys {
#[tauri::command]
fn get_env_keys() -> Keys {
// In development, the CWD is `src-tauri/target/debug`, so we go up two levels
// to find the project root.
if let Ok(path) = std::env::current_dir() {
if let Some(p) = path.ancestors().nth(2) {
let env_path = p.join(".env");
dotenvy::from_path(env_path).ok();
}
} else {
dotenvy::dotenv().ok();
// Load .env file from the project root. This is more robust than assuming a fixed
// directory structure, as it searches upwards from the executable's location.
match dotenvy::dotenv() {
Ok(_) => println!("✅ [Rust] Successfully loaded .env file."),
Err(e) => println!("❌ [Rust] Failed to load .env file: {}", e),
}
let openrouter_api_key = std::env::var("OPENROUTER_API_KEY").ok();
let elevenlabs_api_key = std::env::var("ELEVENLABS_API_KEY").ok();
// Add detailed logging to see what Rust is reading
println!("🔑 [Rust] OpenRouter Key Loaded: {}", openrouter_api_key.is_some());
println!("🔑 [Rust] ElevenLabs Key Loaded: {}", elevenlabs_api_key.is_some());
Keys { openrouter_api_key, elevenlabs_api_key }
}
@@ -33,10 +36,41 @@ fn greet(name: &str) -> String {
format!("Hello, {}! Welcome to EVE.", name)
}
#[tauri::command]
fn send_notification(app_handle: tauri::AppHandle, title: String, body: String) -> Result<(), String> {
Notification::new(&app_handle.config().tauri.bundle.identifier)
.title(&title)
.body(&body)
.show()
.map_err(|e| e.to_string())?;
Ok(())
}
fn main() {
// Note: System tray temporarily disabled on Linux due to icon format issues
// The app works perfectly without it - you can minimize/maximize normally
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet, get_env_keys])
.setup(|_app| {
.invoke_handler(tauri::generate_handler![greet, get_env_keys, send_notification])
.setup(|app| {
// Register global shortcut to show/hide EVE
let window = app.get_window("main").unwrap();
let window_clone = window.clone();
// Try to register global shortcut, but don't panic if it fails
match app.global_shortcut_manager()
.register("CommandOrControl+Shift+E", move || {
if window_clone.is_visible().unwrap_or(true) {
let _ = window_clone.hide();
} else {
let _ = window_clone.show();
let _ = window_clone.set_focus();
}
}) {
Ok(_) => println!("✅ Global shortcut registered: Ctrl+Shift+E"),
Err(e) => eprintln!("⚠️ Failed to register global shortcut: {}. The app will work without it.", e),
}
#[cfg(debug_assertions)]
{
// DevTools are available via F12 or the context menu

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "EVE",
"version": "0.1.0"
"version": "0.2.0"
},
"tauri": {
"allowlist": {
@@ -28,6 +28,12 @@
"unminimize": true,
"startDragging": true,
"setAlwaysOnTop": true
},
"globalShortcut": {
"all": true
},
"notification": {
"all": true
}
},
"bundle": {