Environment
- Electrobun 2.0.1 (Hutch 0.27.1),
mainProcess: "bun" - Windows 11 ARM64 running the
win-x64core (x64 emulation), system WebView2 (bundleCEF: false) - Also checked against
main: both issues are still present there.
1. Window title-bar icon is never set on Windows
The window's title bar shows the generic Windows icon. The taskbar shows the correct icon, which comes from the icon embedded in the .exe (build.win.icon).
setWindowIcon is exported but has an empty body on Windows (nativeWrapper.cpp at v2.0.1):
// Window icon - Linux only, no-op for Windows
extern "C" ELECTROBUN_EXPORT void setWindowIcon(void* window, const char* iconPath) {
// Not yet implemented on Windows
}The TypeScript SDK also never calls setWindowIcon, and BrowserWindow has no icon option, so apps have no workaround.
Suggestion: by default, set the window's big and small icons from the executable's embedded icon (WM_SETICON with ICON_BIG/ICON_SMALL, or hIcon/hIconSm on the window class). Optionally, expose an icon option on BrowserWindow.
2. Tray ignores PNG images on Windows
new Tray({ image: "views://assets/icon.png" }) shows the generic application icon on Windows, while the same PNG works on macOS and Linux. The Windows code loads the image as an ICO file (v2.0.1):
statusItem->nid.hIcon = (HICON)LoadImageW(NULL, wImagePath.c_str(), IMAGE_ICON,
width, height, LR_LOADFROMFILE);
...
if (!statusItem->nid.hIcon) {
statusItem->nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);LoadImageW(..., IMAGE_ICON, LR_LOADFROMFILE) only reads .ico files, so a PNG fails, and the fallback hides the failure except for a log line. The Tray docs show a .png example and don't mention this.
Workaround: pass an .ico on Windows (one with PNG-compressed entries works).
Suggestion: either decode PNGs on Windows (e.g. WIC → CreateIconIndirect), or document that the Windows tray needs .ico, and log a clearer message when a non-ICO path is given.
This gist has workaround for this issue: https://gist.github.com/petersvp/eb4041bfba3141bcc2d127d231db7a53