Skip to content

Add a Celsius/Fahrenheit toggle to the weather widget - #8278

Open
Jhon-opt wants to merge 2 commits into
omacom:quattrofrom
Jhon-opt:weather-unit-toggle
Open

Jhon-opt wants to merge 2 commits into
omacom:quattrofrom
Jhon-opt:weather-unit-toggle

Conversation

@Jhon-opt

Copy link
Copy Markdown

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

  • Click the degree label in the panel hero to pin the opposite unit.
  • A small dot appears while pinned; click it to return to automatic — the
    location picks the unit again, using the precedence from the country
    detection change.
  • SUPER + ALT + U flips while automatic and restores automatic when
    pinned, so automatic is always one press away. Exposed as
    omarchy-shell omarchy.weather toggleUnit, with
    omarchy-toggle-weather-unit forwarding to it so menus and scripts can
    reach the same behavior.
  • The degree label states the mode on hover ("Automatic · following
    " / "Pinned °F · click to switch" / "Let your location pick the
    unit").

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.

Design

auto is a first-class stored state (empty unit), pinned is any explicit
value, 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.sh at 71 assertions total: the pin/auto/IPC source
contract 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.sh passes.

Happy to attach panel captures if useful.

Copilot AI balanced review requested due to automatic review settings August 25, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 is SUPER + 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.

Comment on lines +101 to +108
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
}
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.
@Jhon-opt
Jhon-opt force-pushed the weather-unit-toggle branch from 675d353 to 855575c Compare October 19, 2026 16:44
@Jhon-opt

Copy link
Copy Markdown
Author

Rebased onto current quattro (was 928 commits behind; this branch is stacked on #8277). Resolved the one conflict in Panel.qml by keeping upstream's textFormat: Text.PlainText alongside the new id: unitLabel.

Also fixed the two unit tooltips: they bound visible to HoverHandler.containsMouse, which does not exist (it is hovered), so they never appeared and logged Unable to assign [undefined] to bool on every open. test/shell.d/weather-test.sh passes.

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[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.

Findings

  1. P2 Weather hints stay English ▶
  2. P2 Unneeded command example ▶

Summary

Adds visible Celsius/Fahrenheit controls, a reset-to-automatic dot, and a shortcut backed by shell IPC.

  • The weather panel lets people pin a temperature unit and switch back to automatic.
  • Automatic weather units follow the selected location’s country when it is known.

Reviews (1) · Last reviewed commit: "Add a Celsius/Fahrenheit toggle to the w..." · Reviewed by Greptile

Comment on lines +649 to +651
text: root.unitPinned
? "Pinned " + root.tempUnit + " · click to switch"
: "Automatic · following " + (root.reportLocation || "your location")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Weather hints stay English

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unneeded command example

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.

Suggested change
# 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!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants