From fbdc0f9df2402905824cde6c81b934b3deb065fb Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 3 Nov 2026 09:11:35 +0000 Subject: [PATCH] use nerd icon if cannot acces wttr.in --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 97f867a..2b0ba9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,12 +63,13 @@ fn main() { let json_str = read_to_string(&cachefile).unwrap(); serde_json::from_str::(&json_str).unwrap() } else { + let error_icon = if args.nerd { "󰅤" } else { "⛓️‍💥" }; loop { match client.get(&weather_url).send() { Ok(response) => match response.json::() { Ok(json) => break json, Err(_) => { - println!("{{\"text\":\"⛓️‍💥\", \"tooltip\":\"invalid wttr.in response\"}}"); + println!("{{\"text\":\"{}\", \"tooltip\":\"invalid wttr.in response\"}}", error_icon); exit(0) } }, @@ -77,7 +78,7 @@ fn main() { thread::sleep(time::Duration::from_millis(500 * iterations)); if iterations == threshold { - println!("{{\"text\":\"⛓️‍💥\", \"tooltip\":\"cannot access wttr.in\"}}"); + println!("{{\"text\":\"{}\", \"tooltip\":\"cannot access wttr.in\"}}", error_icon); exit(0) } }