Skip to content

Show the nighttime fog icon in the bar - #9367

Closed
chessing234 wants to merge 2 commits into
omacom:quattrofrom
chessing234:fix/weather-icon-night-fog
Closed

chessing234 wants to merge 2 commits into
omacom:quattrofrom
chessing234:fix/weather-icon-night-fog

Conversation

@chessing234

Copy link
Copy Markdown
Contributor

omarchy-weather-icon fetches the live sunrise and sunset from wttr.in and sets night from them, then maps the weather code to a glyph. Every day/night-aware arm of that case statement branches on night except the fog one:

119|122) icon="" ;;
143|248|260) icon="" ;;
176|263|353) [[ $night == "true" ]] && icon="" || icon="" ;;

The panel disagrees. shell/plugins/panels/weather/Model.js resolves the same three wttr codes as night ? "" : "", and iconForOpenMeteoCode routes Open-Meteo 45/48 through them. So after sunset in fog or mist the bar showed the daytime glyph while the panel showed the nighttime one, for the same condition at the same moment.

The fix branches the fog arm on night with the same two codepoints the panel uses.

Verification, with the repo's shell suite: the new sweep in test/shell.d/weather-test.sh stubs curl and date so the script sees a fixed wttr payload and a fixed clock, then runs the real bin/omarchy-weather-icon for one code from every arm of its case statement — plus an unmapped code for the fallback — once past sunrise and once past sunset, comparing each result to Model.iconForCode rather than to a second copy of the mapping.

ok - weather icon matches the panel's daytime glyphs
ok - weather icon matches the panel's nighttime glyphs

Reverting only the one-line bin/ change and re-running gives:

ok - weather icon matches the panel's daytime glyphs
code 143:  != 
code 248:  != 
code 260:  != 
not ok - weather icon matches the panel's nighttime glyphs

The whole weather-test.sh file passes with the fix in place.

The weather panel's Model.iconForCode resolves fog codes 143, 248 and 260
to a nighttime glyph after sunset, but omarchy-weather-icon returned the
daytime glyph for those three codes at every hour. The script already
computes `night` from the live sunrise/sunset it fetches, and every other
day/night-aware arm of the same case statement uses it; the fog arm was
the one that did not.
Stubs curl and date so the script sees a fixed wttr payload and a fixed
clock, then sweeps one code from every arm of its case statement past
sunrise and past sunset, comparing each result against Model.iconForCode
rather than a second hand-written copy of the mapping.

Against the unfixed script the nighttime sweep reports codes 143, 248
and 260 as mismatched and the daytime sweep still passes.
@chessing234

Copy link
Copy Markdown
Contributor Author

@dhh @ryanrhughes ready for review

chessing234 added a commit to chessing234/omarchy that referenced this pull request Sep 21, 2026
@chessing234

Copy link
Copy Markdown
Contributor Author

folded into #12115 so the weather icon review stays with the other bar panel tweaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant