Skip to content

Commit 38fa59e

Browse files
committed
feat: dcrypt app icon — window/dock icon from resources
1 parent 8572cd0 commit 38fa59e

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

apps/desktop/resources/icon.png

23.1 KB
Loading

apps/desktop/resources/icon.svg

Lines changed: 18 additions & 0 deletions
Loading

apps/desktop/src/main/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app, BrowserWindow, powerMonitor, session, shell } from 'electron';
1+
import { app, BrowserWindow, nativeImage, powerMonitor, session, shell } from 'electron';
22
import * as path from 'path';
33

44
import { CHANNELS } from '../shared/api';
@@ -7,6 +7,10 @@ import { VaultService } from './vault-service';
77

88
const DEV_SERVER_URL = process.env.ELECTRON_RENDERER_URL;
99

10+
const APP_ICON = nativeImage.createFromPath(
11+
path.join(__dirname, '../../resources/icon.png')
12+
);
13+
1014
const service = new VaultService();
1115

1216
/** Minutes of user idle time before the vault locks itself. */
@@ -27,6 +31,7 @@ const createWindow = (): BrowserWindow => {
2731
minHeight: 600,
2832
show: false,
2933
autoHideMenuBar: true,
34+
icon: APP_ICON,
3035
webPreferences: {
3136
preload: path.join(__dirname, '../preload/index.js'),
3237
contextIsolation: true,
@@ -90,6 +95,10 @@ app.whenReady().then(() => {
9095
callback({ cancel: !allowed });
9196
});
9297

98+
if (process.platform === 'darwin' && !APP_ICON.isEmpty()) {
99+
app.dock?.setIcon(APP_ICON);
100+
}
101+
93102
registerIpc(service);
94103
mainWindow = createWindow();
95104
watchIdle();

0 commit comments

Comments
 (0)