mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
fix(ui): display correct icon in the dock and messagebox in dev mode
This commit is contained in:
parent
9339efe951
commit
be4cb34398
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
import electron, {
|
import electron, {
|
||||||
app,
|
app,
|
||||||
dialog,
|
dialog,
|
||||||
@ -21,6 +22,8 @@ import theme from '@/theme';
|
|||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
const isMac = process.platform === 'darwin';
|
const isMac = process.platform === 'darwin';
|
||||||
const isLinux = process.platform === 'linux';
|
const isLinux = process.platform === 'linux';
|
||||||
|
const title = 'Frappe Books';
|
||||||
|
const icon = path.resolve('./build/icon.png');
|
||||||
|
|
||||||
// Global ref to prevent garbage collection.
|
// Global ref to prevent garbage collection.
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
@ -59,6 +62,8 @@ function createWindow() {
|
|||||||
backgroundColor: '#80FFFFFF',
|
backgroundColor: '#80FFFFFF',
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
icon,
|
||||||
|
title,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
contextIsolation: false, // TODO: Switch this off
|
contextIsolation: false, // TODO: Switch this off
|
||||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
||||||
@ -98,9 +103,11 @@ function createSettingsWindow(tab = 'General') {
|
|||||||
frame: isLinux,
|
frame: isLinux,
|
||||||
width: 460,
|
width: 460,
|
||||||
height: 577,
|
height: 577,
|
||||||
|
icon,
|
||||||
|
title,
|
||||||
backgroundColor: theme.backgroundColor.gray['200'],
|
backgroundColor: theme.backgroundColor.gray['200'],
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
contextIsolation: false, // TODO: Switch this off
|
contextIsolation: false, // TODO: Switch this on
|
||||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
||||||
},
|
},
|
||||||
resizable: false,
|
resizable: false,
|
||||||
@ -187,6 +194,7 @@ ipcMain.handle(IPC_ACTIONS.GET_PRIMARY_DISPLAY_SIZE, (event) => {
|
|||||||
|
|
||||||
ipcMain.handle(IPC_ACTIONS.GET_DIALOG_RESPONSE, async (event, options) => {
|
ipcMain.handle(IPC_ACTIONS.GET_DIALOG_RESPONSE, async (event, options) => {
|
||||||
const window = event.sender.getOwnerBrowserWindow();
|
const window = event.sender.getOwnerBrowserWindow();
|
||||||
|
Object.assign(options, { icon });
|
||||||
return await dialog.showMessageBox(window, options);
|
return await dialog.showMessageBox(window, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -227,6 +235,10 @@ app.on('ready', async () => {
|
|||||||
createWindow();
|
createWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isMac) {
|
||||||
|
app.dock.setIcon(icon);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------
|
/* ------------------------------
|
||||||
* Register node#process messages
|
* Register node#process messages
|
||||||
* ------------------------------*/
|
* ------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user