Use platform-specific window icons

This commit is contained in:
Josh Perez 2020-04-20 17:07:16 -04:00 committed by Scott Nonnenberg
parent ebb3864f58
commit 5e3bbf1dc0
3 changed files with 13 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

15
main.js
View file

@ -259,6 +259,17 @@ function isVisible(window, bounds) {
); );
} }
let windowIcon;
const OS = process.platform;
if (OS === 'win32') {
windowIcon = path.join(__dirname, 'build', 'icons', 'win', 'icon.ico');
} else if (OS === 'linux') {
windowIcon = path.join(__dirname, 'images', 'signal-logo-desktop-linux.png');
} else {
windowIcon = path.join(__dirname, 'build', 'icons', 'png', '512x512.png');
}
async function createWindow() { async function createWindow() {
const { screen } = electron; const { screen } = electron;
const windowOptions = Object.assign( const windowOptions = Object.assign(
@ -281,7 +292,7 @@ async function createWindow() {
nativeWindowOpen: true, nativeWindowOpen: true,
spellcheck: await getSpellCheckSetting(), spellcheck: await getSpellCheckSetting(),
}, },
icon: path.join(__dirname, 'images', 'icon_256.png'), icon: windowIcon,
}, },
_.pick(windowConfig, ['autoHideMenuBar', 'width', 'height', 'x', 'y']) _.pick(windowConfig, ['autoHideMenuBar', 'width', 'height', 'x', 'y'])
); );
@ -836,7 +847,7 @@ app.on('ready', async () => {
nodeIntegration: false, nodeIntegration: false,
preload: path.join(__dirname, 'loading_preload.js'), preload: path.join(__dirname, 'loading_preload.js'),
}, },
icon: path.join(__dirname, 'images', 'icon_256.png'), icon: windowIcon,
}); });
loadingWindow.once('ready-to-show', async () => { loadingWindow.once('ready-to-show', async () => {