fix(desktop): rewrite tray loader with explicit per-platform branches
Three branches now: macOS template (.png + @2x, auto-recolour), Windows
multi-size .ico (DPI auto-pick), Linux 22x22 PNG. Drops the runtime
.resize({16,16}) — pre-rendered assets are at correct platform sizes;
runtime resize re-introduced bicubic blur. Defensive fallback to the
programmatic blurple circle is preserved but should not trigger in
practice now that templates ship populated.
This commit is contained in:
@@ -253,12 +253,20 @@ function loadTrayIcon(): Electron.NativeImage {
|
|||||||
icon.setTemplateImage(true);
|
icon.setTemplateImage(true);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
} else if (process.platform === 'win32') {
|
||||||
|
// Windows: multi-size .ico — Windows + Electron auto-pick best size for current DPI.
|
||||||
|
const icoPath = path.join(resourcesDir, 'tray-icon.ico');
|
||||||
|
const icon = nativeImage.createFromPath(icoPath);
|
||||||
|
if (!icon.isEmpty()) {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Windows/Linux: colored icon
|
// Linux: single 22x22 PNG (AppIndicator / StatusNotifier convention).
|
||||||
|
// No runtime resize — the source is already at correct tray size.
|
||||||
const iconPath = path.join(resourcesDir, 'tray-icon.png');
|
const iconPath = path.join(resourcesDir, 'tray-icon.png');
|
||||||
const icon = nativeImage.createFromPath(iconPath);
|
const icon = nativeImage.createFromPath(iconPath);
|
||||||
if (!icon.isEmpty()) {
|
if (!icon.isEmpty()) {
|
||||||
return icon.resize({ width: 16, height: 16 });
|
return icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user