xmobar: treat CAVOK/NSC weather reports as clear

NOAA's decoded METAR has no sky conditions line for CAVOK or NSC, so the
weather showed a generic cloud icon and "Unknown"; read them from the raw
observation as clear.
This commit is contained in:
Daniele Fucini committed 2026-11-13 18:23:14 +01:00
1 parent 216e1bff0f
commit 248a9b7d1f
1 file changed
+2
+2
View File
@@ -26,6 +26,8 @@ fi
wx=$(sed -n 's/^Weather: //p' <<< "$report" | tr ';' '\n' | sed 's/^ *//' | grep -v vicinity)
wx=${wx,,}
sky=$(sed -n 's/^Sky conditions: //p' <<< "$report")
# CAVOK/NSC (no cloud below 5000 ft) have no sky line in the decoded report
[[ -z $sky ]] && grep -qE '^ob: .* (CAVOK|NSC) ' <<< "$report" && sky=clear
sky=${sky,,}
# Sun above the horizon (elevation > -0.833°, as for sunrise/sunset) right now, from the low-precision solar position