feat(icon): apply runtime app icon on macOS (#2296)
This commit is contained in:
parent
de9e90df45
commit
194bb28c8c
Binary file not shown.
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 224 KiB |
|
|
@ -5,6 +5,7 @@ import {
|
|||
dialog,
|
||||
ipcMain,
|
||||
net,
|
||||
nativeImage,
|
||||
Notification as ElectronNotification,
|
||||
protocol,
|
||||
shell,
|
||||
|
|
@ -156,6 +157,16 @@ function windowIconPath(): string | undefined {
|
|||
return existsSync(candidate) ? candidate : undefined;
|
||||
}
|
||||
|
||||
function applyRuntimeAppIcon(): void {
|
||||
if (process.platform !== "darwin") return;
|
||||
const iconPath = windowIconPath();
|
||||
if (!iconPath) return;
|
||||
const icon = nativeImage.createFromPath(iconPath);
|
||||
if (!icon.isEmpty()) {
|
||||
app.dock.setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
function setDaemonStatus(nextStatus: DaemonStatus): void {
|
||||
daemonStatus = nextStatus;
|
||||
mainWindow?.webContents.send("daemon:status", daemonStatus);
|
||||
|
|
@ -952,6 +963,7 @@ app.whenReady().then(async () => {
|
|||
}
|
||||
|
||||
registerRendererProtocol();
|
||||
applyRuntimeAppIcon();
|
||||
createWindow();
|
||||
void startDaemon();
|
||||
initAutoUpdates();
|
||||
|
|
|
|||
Loading…
Reference in New Issue