Weather applet for cosmic desktop, using wttr.lerch.org
Find a file
Emil Lerch 21a2e5299c
Some checks failed
CI / Clippy (push) Failing after 1m32s
CI / Build (release) (push) Successful in 2m27s
CI / Build (debug) (push) Successful in 3m44s
CI / Notify (push) Successful in 2s
fix failed full weather fetch and implement cache for full
2026-04-20 05:16:16 -07:00
.forgejo/workflows notifications 2026-03-02 15:13:16 -08:00
i18n/en cargo generate gh:pop-os/cosmic-app-template 2026-01-20 14:30:28 -08:00
resources cargo generate gh:pop-os/cosmic-app-template 2026-01-20 14:30:28 -08:00
src fix failed full weather fetch and implement cache for full 2026-04-20 05:16:16 -07:00
.gitignore initial implementation 2026-01-26 12:42:19 -08:00
.mise.toml initial implementation 2026-01-26 12:42:19 -08:00
Cargo.lock update on network change 2026-04-20 04:39:54 -07:00
Cargo.toml update on network change 2026-04-20 04:39:54 -07:00
i18n.toml cargo generate gh:pop-os/cosmic-app-template 2026-01-20 14:30:28 -08:00
justfile ai: work around popup size and get the width right 2026-03-02 13:12:52 -08:00
LICENSE cargo generate gh:pop-os/cosmic-app-template 2026-01-20 14:30:28 -08:00
org.lerch.weather.desktop initial implementation 2026-01-26 12:42:19 -08:00
README.md control units from LC_ALL with config fallback 2026-04-20 04:58:50 -07:00

Cosmic Weather Applet

A weather applet for the COSMIC desktop environment that displays current conditions in the panel and a full forecast in a popup. Weather data is provided by wttr.in using IP-based geolocation.

Building

Requires a Rust toolchain and the following system dependencies:

# Debian/Ubuntu
sudo apt-get install pkg-config libxkbcommon-dev libwayland-dev

Install Rust via rustup if needed, then:

cargo build --release

Testing

For development, cargo run launches the applet in a standalone window in the center of the display. It behaves the same as when embedded in the panel.

cargo run

Deploying

To deploy to your local user session, build a release binary, replace the running instance, and restart the panel so it picks up the new binary:

cargo build --release
cp target/release/cosmic-weather-applet ~/.local/bin/
# Restart the applet and panel
killall cosmic-weather-applet
killall cosmic-panel

The panel will relaunch automatically and load the updated applet.

Configuration

Temperature and wind units

By default, the applet lets wttr.in pick units based on your IP-based location (so users in the US get Fahrenheit, everyone else gets Celsius).

At startup the applet additionally inspects your measurement locale (LC_MEASUREMENT, then LC_ALL, then LANG). Locales in the US, Liberia, the Bahamas, Belize, the Cayman Islands, and Palau are requested as Fahrenheit / USCS; all other locales fall through to the wttr.in default.

To override the choice explicitly, set COSMIC_WEATHER_UNITS:

Value Meaning
u Fahrenheit, mph (USCS)
m Celsius, km/h (metric)
M Celsius, m/s
auto (or unset) Use locale / geolocation

Because the applet is launched by cosmic-panel, a persistent override is easiest to set on that service, e.g.:

systemctl --user edit cosmic-panel
# In the override file:
# [Service]
# Environment=COSMIC_WEATHER_UNITS=u

systemctl --user restart cosmic-panel

Changes take effect after the applet is restarted.

Localization

Fluent is used for localization. Translation files are in the i18n directory. To add a new language, copy the English (en) localization, rename the directory to the target ISO 639-1 language code, and translate the message values.