A lightweight SwiftBar/xbar plugin that displays current weather conditions in the macOS menu bar.
⛅ 68°F
---
📍 San Francisco
Conditions: Partly cloudy
Humidity: 72%
Wind: 12 mph
---
Updated: 14:30
- Shows temperature with a weather emoji in the menu bar
- Dropdown with city name, conditions, humidity, and wind speed
- Auto-detects location via IP geolocation — no configuration required
- Supports manual coordinates for pinpoint accuracy
- Fahrenheit or Celsius
- No API key needed — uses the free Open-Meteo API
- No external dependencies beyond standard macOS tools (
curl,bc)
- Install SwiftBar (or xbar).
- Copy
weather.30m.shto your SwiftBar plugins directory. - Make it executable:
chmod +x weather.30m.sh
- SwiftBar will pick it up automatically and refresh every 30 minutes.
Open the plugin's variable editor in SwiftBar to set:
| Variable | Default | Description |
|---|---|---|
VAR_LATITUDE |
(empty) | Latitude — leave blank to auto-detect via IP |
VAR_LONGITUDE |
(empty) | Longitude — leave blank to auto-detect via IP |
VAR_UNIT |
fahrenheit |
fahrenheit or celsius |
When coordinates are left blank, the plugin resolves your location from ipinfo.io and caches the result for 6 hours to avoid repeated lookups.
- Location — resolves via
ipinfo.io/json(IP-based geolocation) or user-supplied coordinates. Results are cached at/tmp/swiftbar_weather_location.cachefor 6 hours. - Weather data — fetches current conditions from
api.open-meteo.comusing the WMO weather code, temperature, humidity, and wind speed fields. - JSON parsing — done with
sedonly; nojqrequired. - Output — formats the menu bar line and dropdown according to the SwiftBar plugin protocol.
curl— HTTP requestsbc— floating-point math
Both ship with macOS.