2
0
mirror of https://github.com/frappe/books.git synced 2025-01-24 07:38:25 +00:00

fix: set icon only if in dev mode, else not req

This commit is contained in:
18alantom 2021-12-07 13:01:15 +05:30
parent 1d0db3579a
commit ad3b41721d

View File

@ -54,13 +54,12 @@ function getMainWindowSize() {
function createWindow() { function createWindow() {
let { width, height } = getMainWindowSize(); let { width, height } = getMainWindowSize();
mainWindow = new BrowserWindow({ const options = {
vibrancy: 'sidebar', vibrancy: 'sidebar',
transparent: isMac, transparent: isMac,
backgroundColor: '#80FFFFFF', backgroundColor: '#80FFFFFF',
width, width,
height, height,
icon,
title, title,
webPreferences: { webPreferences: {
contextIsolation: false, // TODO: Switch this off contextIsolation: false, // TODO: Switch this off
@ -68,7 +67,13 @@ function createWindow() {
}, },
frame: isLinux, frame: isLinux,
resizable: true, resizable: true,
}); };
if (isDevelopment) {
Object.assign(options, { icon });
}
mainWindow = new BrowserWindow(options);
if (process.env.WEBPACK_DEV_SERVER_URL) { if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode // Load the url of the dev server if in development mode
@ -166,7 +171,9 @@ 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 }); if (isDevelopment) {
Object.assign(options, { icon });
}
return await dialog.showMessageBox(window, options); return await dialog.showMessageBox(window, options);
}); });
@ -207,7 +214,7 @@ app.on('ready', async () => {
createWindow(); createWindow();
}); });
if (isMac) { if (isMac && isDevelopment) {
app.dock.setIcon(icon); app.dock.setIcon(icon);
} }