1#[cfg(target_os = "linux")]
9pub fn toast(title: &str, body: &str) {
10 let _ = std::process::Command::new("notify-send")
11 .arg("--app-name=wire")
12 .arg("--icon=mail-message-new")
13 .arg(title)
14 .arg(body)
15 .output();
16}
17
18#[cfg(target_os = "macos")]
19pub fn toast(title: &str, body: &str) {
20 let safe = |s: &str| s.replace('\\', "\\\\").replace('"', "\\\"");
21 let script = format!(
22 "display notification \"{}\" with title \"{}\"",
23 safe(body),
24 safe(title),
25 );
26 let _ = std::process::Command::new("osascript")
27 .arg("-e")
28 .arg(script)
29 .output();
30}
31
32#[cfg(target_os = "windows")]
33pub fn toast(title: &str, body: &str) {
34 eprintln!("[wire notify] {title}\n {body}");
35}
36
37#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
38pub fn toast(title: &str, body: &str) {
39 eprintln!("[wire notify] {title}\n {body}");
40}