From 02a9dbef29c8417fc213ab964340f3d4a407a29e Mon Sep 17 00:00:00 2001 From: John Mertz Date: Thu, 20 Jul 2023 16:12:31 -0400 Subject: [PATCH] Fallback icon if weather is unknown Double-width question mark to match double-width weather icons --- waybar/waybar-weather.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waybar/waybar-weather.pl b/waybar/waybar-weather.pl index 5c67f86..a7d39d4 100755 --- a/waybar/waybar-weather.pl +++ b/waybar/waybar-weather.pl @@ -37,7 +37,7 @@ my $ref = $json->decode($ret->{_content}); if ($cmd eq 'bar') { my $temp = $ref->{current}->{temp} - 273.15; - my $icon = $ref->{current}->{weather}->[0]->{icon}; + my $icon = $ref->{current}->{weather}->[0]->{icon} //= '?'; printf("%s%.1f%s", $icons{$icon}, ${temp}, "°C"); } elsif ($cmd eq 'notify') {