The previous fix attached a 32x32 @2x representation to the 16x16 PNG, which only covers 100% and 200% scale factors. Users on 125/150/175/ 250%+ still got a blurry tray icon because Windows had to resample from one of those two sizes. Ship a proper multi-size tray-icon.ico (16, 20, 24, 32, 40, 48, 64) and point the Windows tray loader at it. Windows picks the closest size per DPI scale on its own, so no addRepresentation / resize juggling is needed. Linux keeps the existing PNG + @2x path; macOS is unchanged. Also add scripts/generate-tray-ico.py so the .ico can be regenerated from public/icon-win.png whenever the source artwork changes. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
989 B
Python
31 lines
989 B
Python
#!/usr/bin/env python3
|
|
"""Generate public/tray-icon.ico from public/icon-win.png with multiple
|
|
sizes so Windows can pick the right pixel dimensions per DPI scale.
|
|
|
|
Sizes mirror what Explorer requests for the notification area on typical
|
|
DPI scale factors (100/125/150/175/200/250/300/400 %):
|
|
16, 20, 24, 32, 40, 48, 64
|
|
|
|
Run: python3 scripts/generate-tray-ico.py
|
|
Requires: Pillow (pip install Pillow)
|
|
"""
|
|
from pathlib import Path
|
|
from PIL import Image
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE = ROOT / "public" / "icon-win.png"
|
|
OUT = ROOT / "public" / "tray-icon.ico"
|
|
SIZES = [(16, 16), (20, 20), (24, 24), (32, 32), (40, 40), (48, 48), (64, 64)]
|
|
|
|
|
|
def main() -> None:
|
|
if not SOURCE.exists():
|
|
raise SystemExit(f"source icon not found: {SOURCE}")
|
|
src = Image.open(SOURCE).convert("RGBA")
|
|
src.save(OUT, format="ICO", sizes=SIZES)
|
|
print(f"wrote {OUT.relative_to(ROOT)} ({', '.join(f'{w}x{h}' for w, h in SIZES)})")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|