Skip to content

Commit 194bb28

Browse files
authored
feat(icon): apply runtime app icon on macOS (#2296)
1 parent de9e90d commit 194bb28

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

frontend/assets/icon.png

-14.1 KB
Loading

frontend/src/main.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
dialog,
66
ipcMain,
77
net,
8+
nativeImage,
89
Notification as ElectronNotification,
910
protocol,
1011
shell,
@@ -156,6 +157,16 @@ function windowIconPath(): string | undefined {
156157
return existsSync(candidate) ? candidate : undefined;
157158
}
158159

160+
function applyRuntimeAppIcon(): void {
161+
if (process.platform !== "darwin") return;
162+
const iconPath = windowIconPath();
163+
if (!iconPath) return;
164+
const icon = nativeImage.createFromPath(iconPath);
165+
if (!icon.isEmpty()) {
166+
app.dock.setIcon(icon);
167+
}
168+
}
169+
159170
function setDaemonStatus(nextStatus: DaemonStatus): void {
160171
daemonStatus = nextStatus;
161172
mainWindow?.webContents.send("daemon:status", daemonStatus);
@@ -952,6 +963,7 @@ app.whenReady().then(async () => {
952963
}
953964

954965
registerRendererProtocol();
966+
applyRuntimeAppIcon();
955967
createWindow();
956968
void startDaemon();
957969
initAutoUpdates();

0 commit comments

Comments
 (0)