Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Adds persistent weather-unit controls atop country-aware automatic detection.
Changes:
- Adds panel controls and IPC for pinning/resetting units.
- Persists location country and clone-specific settings.
- Adds a command, keybinding, and tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
shell/plugins/panels/weather/Panel.qml |
Implements unit state, controls, persistence, and country precedence. |
shell/plugins/panels/weather/Model.js |
Parses and propagates location countries. |
shell/plugins/panels/weather/BarWidget.qml |
Passes clone-specific widget IDs to the panel. |
bin/omarchy-weather-location |
Stores countries using atomic writes. |
bin/omarchy-toggle-weather-unit |
Adds the unit-toggle command. |
default/hypr/bindings/utilities.lua |
Adds the keyboard shortcut. |
test/shell.d/weather-test.sh |
Covers country and toggle contracts. |
Suppressed comments (1)
shell/plugins/panels/weather/Panel.qml:286
- The shortcut documented here omits
ALT; the added binding isSUPER + ALT + U. Keeping the exact chord in the comment prevents misleading future maintenance.
// SUPER + U and the IPC toggle flip while automatic and restore automatic
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| onLoaded: { | ||
| var parsed = Model.parseLocationFile(text()) | ||
| // A read caught mid-write (truncated JSON) parses as unset; keep the | ||
| // previous state so the unit does not flap through the locale | ||
| // fallback for a frame. An empty file is a real clear. | ||
| if (parsed.name === "" && String(text()).trim() !== "") return | ||
| root.configuredLocationState = parsed | ||
| } |
e89225f to
675d353
Compare
Unit selection relied on wttr.in reporting a nearest_area country at runtime. With pinned coordinates, current conditions come from Open-Meteo and no area is known until (or unless) wttr answers, so the check fell through to the session locale — an en_US locale showing Fahrenheit for a pinned Colombian city. The geocoder already returns each result's country; keep it in the suggestions, persist it alongside name and coordinates via omarchy-weather-location --set <name> [lat,lon] [country], and prefer it in shouldUseImperial before wttr's reported area and the locale. The location file is now written atomically and a mid-write read keeps the previous state, so the unit no longer flaps while the file changes. Existing weather.json files without a country behave exactly as before.
The unit was only changeable by hand-editing shell.json. The panel now flips °C/°F from the hero degree label itself, following the clock's persistSettings pattern, and exposes toggleUnit over IPC so a keybinding or menu can reach it: omarchy-toggle-weather-unit forwards to that IPC call, is bound to SUPER + U by default, and keeps the shell as the single owner of the unit precedence. injectPanel now hands the panel the mounted widget id, so cloned widgets (<user>.weather) persist settings into their own shell.json entry instead of silently writing to one that does not exist.
675d353 to
855575c
Compare
|
Rebased onto current Also fixed the two unit tooltips: they bound |
[Medium impact] The changes stay within the weather widget and its location settings. The toggle appears sound, but the tooltip translations and command metadata must meet repository requirements before merging. FindingsSummaryAdds visible Celsius/Fahrenheit controls, a reset-to-automatic dot, and a shortcut backed by shell IPC.
Reviews (1) · Last reviewed commit: "Add a Celsius/Fahrenheit toggle to the w..." · Reviewed by Greptile |
| text: root.unitPinned | ||
| ? "Pinned " + root.tempUnit + " · click to switch" | ||
| : "Automatic · following " + (root.reportLocation || "your location") |
There was a problem hiding this comment.
The new mode tooltips and reset hint contain English text directly in Panel.qml. The repository requires new shell text to have an English catalog entry and use I18n.t(...). Add keys for both mode descriptions, the location fallback, and the reset hint. Use placeholders for the unit and location so translations can reorder them. This requirement must be satisfied before merging.
File Used: docs/i18n.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| #!/bin/bash | ||
|
|
||
| # omarchy:summary=Toggle the weather widget between Celsius and Fahrenheit | ||
| # omarchy:examples=omarchy toggle weather unit |
There was a problem hiding this comment.
This command declares omarchy:examples even though it rejects all arguments. The command metadata guide allows examples only when arguments need explaining. Remove this line to satisfy the repository requirement before merging.
| # omarchy:examples=omarchy toggle weather unit |
File Used: agents/skills/command-metadata.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Stacked on #8277 — merge that first; this diff shrinks to the toggle once it
lands.
The unit was only changeable by hand-editing shell.json. This adds a visible,
recoverable toggle that mirrors the network panel's Automatic/pinned band
pattern.
What
location picks the unit again, using the precedence from the country
detection change.
pinned, so automatic is always one press away. Exposed as
omarchy-shell omarchy.weather toggleUnit, withomarchy-toggle-weather-unitforwarding to it so menus and scripts canreach the same behavior.
" / "Pinned °F · click to switch" / "Let your location pick the
unit").
injectPanelnow hands the panel the mounted widget id, so cloned widgets(
<user>.weather) persist settings into their own shell.json entry instead ofsilently writing to one that does not exist.
Design
autois a first-class stored state (emptyunit),pinnedis any explicitvalue, and the affordance collapses to nothing while automatic — the bar looks
exactly like stock until a unit is pinned. The keybinding sits near the
existing weather binding (SUPER+CTRL+ALT+W) and is trivial to move if another
spot is preferred.
Tests
test/shell.d/weather-test.shat 71 assertions total: the pin/auto/IPC sourcecontract on Panel.qml and BarWidget.qml, and end-to-end cases for the toggle
command (forwards to the shell IPC; rejects arguments).
./test/shell.d/weather-test.shpasses.Happy to attach panel captures if useful.