diff --git a/crates/jarvis-app/Cargo.toml b/crates/jarvis-app/Cargo.toml index 78353b5..9a1cf02 100644 --- a/crates/jarvis-app/Cargo.toml +++ b/crates/jarvis-app/Cargo.toml @@ -26,6 +26,7 @@ features = [] [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["winuser"] } +winrt-notification.workspace = true [target.'cfg(target_os = "linux")'.dependencies] gtk = "0.18" diff --git a/crates/jarvis-app/src/main.rs b/crates/jarvis-app/src/main.rs index 9a57830..1639c8d 100644 --- a/crates/jarvis-app/src/main.rs +++ b/crates/jarvis-app/src/main.rs @@ -59,6 +59,7 @@ fn main() -> Result<(), String> { eprintln!("[jarvis-app] step: recorder::init"); if recorder::init().is_err() { + notify_mic_problem(); app::close(1, "recorder::init failed"); } @@ -173,3 +174,25 @@ fn main() -> Result<(), String> { pub fn should_stop() -> bool { SHOULD_STOP.load(Ordering::SeqCst) } + +#[cfg(target_os = "windows")] +fn notify_mic_problem() { + use winrt_notification::{Toast, Duration as ToastDuration}; + + let _ = Toast::new(Toast::POWERSHELL_APP_ID) + .title("J.A.R.V.I.S.: микрофон не найден") + .text1("Windows не видит ни одного устройства записи.") + .text2("Откройте mmsys.cpl → Recording → включите микрофон и перезапустите Jarvis.") + .duration(ToastDuration::Long) + .show(); + + // Open Sound recording settings so the user can fix it in two clicks. + let _ = std::process::Command::new("cmd") + .args(["/C", "start", "", "ms-settings:sound"]) + .spawn(); +} + +#[cfg(not(target_os = "windows"))] +fn notify_mic_problem() { + eprintln!("[jarvis-app] no recording device detected; check OS audio settings"); +}