An open API service indexing awesome lists of open source software.

https://github.com/malkosvetnik/desktop-weather-widget

๐ŸŒค๏ธ Beautiful desktop weather widget for Windows - Better than Microsoft's built-in!
https://github.com/malkosvetnik/desktop-weather-widget

desktop-app desktop-widget open-source openweathermap pyqt5 python serbian weather weather-api windows

Last synced: 5 months ago
JSON representation

๐ŸŒค๏ธ Beautiful desktop weather widget for Windows - Better than Microsoft's built-in!

Awesome Lists containing this project

README

          

# ๐ŸŒค๏ธ Desktop Weather Widget v2.2.3

**Elegant, minimalist desktop weather widget with Windows Location support, multi-language localization, and advanced features.**

![Main Widget - Serbian](screenshots/main_widget_serbian.png)

---

## โœจ Key Features

### ๐ŸŒ **Location**
- ๐Ÿ”„ **API Auto-detection** (IP geolocation)
- ๐Ÿ“ **Windows Location API** (GPS/Wi-Fi triangulation)
- ๐Ÿ” **Manual search** for cities worldwide
- ๐ŸŒ **Reverse geocoding** for city name display

### ๐ŸŒก๏ธ **Weather Data**
- ๐ŸŒค๏ธ **Current weather** with detailed data
- ๐Ÿ“Š **5-day forecast** (min/max temperature)
- ๐Ÿ• **Hourly forecast** for the next 12 hours (tooltip)
- ๐ŸŒง๏ธ **Precipitation** with precise predictions (minutely_15)
- ๐ŸŒซ๏ธ **Air quality** (European AQI) with detailed pollutants
- โ˜€๏ธ **UV Index** with color coding by level
- ๐Ÿ‘๏ธ **Visibility**, pressure, cloudiness, wind with direction
- ๐ŸŒ… **Sunrise/sunset** times

### ๐ŸŒ **Localization**
- ๐Ÿ‡ท๐Ÿ‡ธ **Serbian** (Latin + Cyrillic)
- ๐Ÿ‡ฌ๐Ÿ‡ง **English**
- ๐Ÿ”ค **Automatic conversion** from Cyrillic to Latin
- ๐Ÿ“… **Localized dates** and days of the week

### โš™๏ธ **Settings**
- ๐ŸŒก๏ธ **Celsius / Fahrenheit** (independent from others)
- ๐Ÿ• **12h / 24h** time format
- ๐Ÿ“ **Metric / Imperial** units (wind, pressure, visibility)
- ๐Ÿ“ **API / Windows Location** sources
- ๐Ÿ”„ **Refresh interval** (5min, 10min, 15min, 30min, 60min)
- ๐Ÿ“ **Monitor resolution** (8 presets: XGA โ†’ 8K UHD)

### ๐ŸŽจ **UI/UX**
- ๐Ÿ”’ **Lock/Unlock** widget position
- ๐Ÿ‘ป **Click-Through Mode** (mouse transparency)
- ๐Ÿ–ฅ๏ธ **Widget-only Mode** (without tray icon)
- ๐Ÿš€ **Auto-start** with Windows
- ๐Ÿ”‹ **Battery status** (laptops only)
- ๐Ÿ• **Live clock** with seconds
- ๐Ÿ’ก **Tooltips** with detailed data
- ๐ŸŒ™ **Dark theme** with semi-transparent backgrounds

---

## ๐Ÿ“ธ Screenshots

### ๐Ÿ‡ท๐Ÿ‡ธ Serbian Language
![Main Widget - Serbian](screenshots/main_widget_serbian.png)
*Main display with all data*

![Main Widget - 24h format](screenshots/main_widget_24h.png)
*24-hour time format*

![Main Widget - Celsius](screenshots/main_widget_celsius.png)
*Celsius temperature (default)*

![Main Widget - Fahrenheit](screenshots/main_widget_fahrenheit.png)
*Fahrenheit temperature*

![Main Widget - Imperial](screenshots/main_widget_imperial.png)
*Imperial units (mph, inHg)*

### ๐Ÿ‡ฌ๐Ÿ‡ง English Language
![Main Widget - English](screenshots/main_widget_english.png)
*English language interface*

### ๐Ÿ“Š Tooltips
![Hourly Forecast Tooltip](screenshots/hourly_forecast_tooltip.png)
*Hourly forecast for 12 hours with tooltip*

![Hourly Forecast 12h](screenshots/hourly_forecast_tooltip_12h.png)
*Hourly forecast in 12h format*

![Air Quality Tooltip](screenshots/air_quality_tooltip.png)
*Detailed air pollutants*

![Precipitation Alert](screenshots/precipitation_alert.png)
*Precipitation warning*

### โš™๏ธ Menus
![Tray Menu - Full](screenshots/tray_menu_full.png)
*Complete tray menu*

![Tray Menu](screenshots/tray_menu.png)
*Standard tray menu*

![Tray Menu - English](screenshots/tray_menu_english.png)
*Tray menu in English*

![Language Menu](screenshots/language_menu.png)
*Language selection*

![Location Menu - Serbian](screenshots/location_menu_serbian.png)
*Location source menu (Serbian)*

![Location Menu - English](screenshots/location_menu_english.png)
*Location source menu (English)*

![Temperature Menu - Celsius](screenshots/temperature_menu_celsius.png)
*Temperature unit selection*

![Time Format Menu](screenshots/time_format_menu.png)
*Time format selection*

![Unit System Menu](screenshots/unit_system_menu.png)
*Unit system selection*

---

## ๐Ÿš€ Installation

### Prerequisite: Python 3.8+

```bash
# Check Python version
python --version
```

### Installing dependencies

```bash
pip install -r requirements.txt
```

**requirements.txt:**
```
PyQt5>=5.15.0
requests>=2.25.0
psutil>=5.8.0
```

### Running

```bash
python weather_widget_final.pyw
```

---

## ๐Ÿ”ง Configuration

### Windows Location Setup

To use Windows Location API:

1. Open **Settings** (โŠž Win + I)
2. Go to **Privacy & Security โ†’ Location**
3. Turn ON **Location services**
4. Enable **Let apps access your location**

Widget will automatically detect Windows Location status.

### Auto-start with Windows

Right-click on tray icon โ†’ **โœ“ Start with Windows**

Widget will add entry to Windows Registry:
```
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
```

---

## ๐Ÿ“‹ Changelog - v2.2.3 (2025-01-12)

### ๐Ÿ”ฅ **CRITICAL CHANGES:**

#### โœ… **Windows Location FIX**
- **Problem:** `geocoder.windows()` method doesn't exist โ†’ fell back to IP geolocation
- **Solution:** Implemented **PowerShell + .NET System.Device.Location API**
- **Result:** 100% real Windows Location with GPS/Wi-Fi triangulation
- **Accuracy:** Displays location precision in meters
- **No dependencies:** No need for `geocoder` library

**Details:**
```python
# Old code (DOESN'T WORK):
import geocoder
g = geocoder.windows('me') # โŒ Doesn't exist!

# New code (WORKS):
PowerShell โ†’ .NET System.Device.Location API โ†’ JSON โ†’ Python
```

**Output:**
```
๐Ÿ” Attempting to get Windows Location (PowerShell)...
โœ… Windows Location successful: (43.9134, 22.2777)
Accuracy: 106m
โœ… Windows Location: Zajeฤar (43.9134, 22.2777)
```

### ๐ŸŒ **Multi-language support:**
- ๐Ÿ‡ท๐Ÿ‡ธ Serbian (Latin)
- ๐Ÿ‡ฌ๐Ÿ‡ง English
- โœ… All labels, menus, tooltips, warnings localized
- โœ… Automatic conversion from Cyrillic to Latin

### ๐ŸŒก๏ธ **Temperature & Unit System:**
- โœ… Independent **Celsius/Fahrenheit** selection for temperature
- โœ… **Metric/Imperial** for other units (wind, pressure, visibility)
- โœ… Consistency between API calls and display

### ๐Ÿ• **Time Format:**
- โœ… 12-hour format with AM/PM
- โœ… 24-hour format
- โœ… Localized dates (Monday vs Ponedeljak)

### ๐Ÿ”‹ **Battery Status:**
- โœ… Displays only on laptops
- โœ… Different icons: ๐Ÿ”Œ (charging), ๐Ÿ”‹ (full), ๐Ÿชซ (low/critical)
- โœ… Dynamic colors (green/white/orange/red)
- โœ… Real-time updates every 5 seconds

### ๐ŸŒง๏ธ **Precipitation:**
- โœ… Minutely_15 forecast (0-2h) for precision
- โœ… "Rain NOW!" / "Snow NOW!" warnings
- โœ… Predictions with "Rain in 15min" / "Snow in 15min"
- โœ… Precise weather codes (71-77 = snow, rest = rain)

### ๐Ÿ• **Hourly forecast:**
- โœ… Shows NEXT hour (current skipped)
- โœ… Tooltip with 12 future hours
- โœ… Icon, temperature, precipitation probability
- โœ… Automatic detection of precipitation type (rain/snow)

### ๐ŸŒซ๏ธ **Air Quality:**
- โœ… European AQI standard
- โœ… Categories: Excellent/Good/Moderate/Poor/Very Poor
- โœ… Tooltip with details: PM10, PM2.5, CO, NOโ‚‚, SOโ‚‚, Oโ‚ƒ
- โœ… Dynamic colors by AQI level

### ๐Ÿ”„ **Sleep/Wake detection:**
- โœ… Detects laptop sleep/hibernate
- โœ… Waits 30s before first refresh after wake
- โœ… Exponential backoff if network not ready
- โœ… Doesn't destroy last data during offline period

### ๐ŸŽจ **UI Improvements:**
- โœ… Consistent colors and font sizes
- โœ… Transparent backgrounds for all labels
- โœ… Clickable labels with hover effects for tooltips
- โœ… Dark tooltip theme

---

## ๐Ÿ› Bug Fixes

### v2.2.3:
- โœ… **CRITICAL:** Windows Location now works (PowerShell implementation)
- โœ… JSON parsing with regex fallback for PowerShell whitespace
- โœ… Visibility API consistency (always km, conversion to mi later)
- โœ… Precipitation API consistency (always mm, conversion to in later)
- โœ… Wind speed API consistency (m/s โ†’ km/h โ†’ mph)
- โœ… Automatic fallback to API location if Windows Location unavailable

### v2.2.2:
- โœ… Visibility data now from `current` block (not from `hourly`)
- โœ… Pressure consistency between Metric/Imperial
- โœ… Temperature_unit parameter in API call

### v2.2.1:
- โœ… Precipitation unit consistency
- โœ… Wind speed unit consistency

### v2.2.0:
- โœ… Click-through mode with Windows API transparent flag
- โœ… Widget-only mode with tray-removal option

---

## ๐Ÿ› ๏ธ Technical Details

### APIs used:
- **Weather:** [Open-Meteo](https://open-meteo.com/) (free, no API key)
- **Air Quality:** [Open-Meteo Air Quality API](https://open-meteo.com/en/docs/air-quality-api)
- **Geocoding:** [Open-Meteo Geocoding API](https://open-meteo.com/en/docs/geocoding-api)
- **Reverse Geocoding:** [OpenStreetMap Nominatim](https://nominatim.openstreetmap.org/)
- **IP Geolocation:** [ip-api.com](http://ip-api.com/)
- **Windows Location:** .NET System.Device.Location (via PowerShell)

### Architecture:
- **Framework:** PyQt5
- **Language:** Python 3.8+
- **Settings:** QSettings (persistent storage)
- **Networking:** requests library with retry logic
- **Sleep detection:** Timer-based with exponential backoff

### Performance:
- **Refresh rate:** 5-60 minutes (configurable)
- **Battery update:** Every 5 seconds (laptop only)
- **Clock update:** Every second
- **Memory footprint:** ~50-70 MB
- **CPU usage:** <1% (idle), ~5% (refresh)

---

## ๐Ÿ“ License

MIT License - free to use, modify, and distribute.

---

## ๐Ÿค Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.

### Development setup:

```bash
# Clone repo
git clone https://github.com/malkosvetnik/Desktop-Weather-Widget.git
cd Desktop-Weather-Widget

# Install dependencies
pip install -r requirements.txt

# Run
python weather_widget_final.pyw
```

---

## ๐Ÿ™ Acknowledgments

- [Open-Meteo](https://open-meteo.com/) for excellent free Weather API
- [OpenStreetMap Nominatim](https://nominatim.openstreetmap.org/) for reverse geocoding
- PyQt5 community for excellent documentation
- All testers and contributors!

---

## ๐Ÿ“ž Contact

- **GitHub:** [@malkosvetnik](https://github.com/malkosvetnik)
- **Project:** [Desktop Weather Widget](https://github.com/malkosvetnik/Desktop-Weather-Widget)

---

## ๐Ÿ”ฎ Planned Features

- [ ] Skin system with custom design support
- [ ] Widget resize with drag-and-drop
- [ ] Multiple API providers (AccuWeather, WeatherAPI)
- [ ] Notifications for extreme weather
- [ ] Weather history with graphs
- [ ] Export data to CSV/JSON

---

**Enjoy the widget! ๐ŸŒค๏ธ**

---

*Version: 2.2.3 | Released: January 12, 2026*