Skip to content

Commit b7a19c6

Browse files
authored
Merge pull request element-hq#10097 from vector-im/jryans/linux-icons
Fix default Electron window and tray icons
2 parents 8458aa7 + f3bfb08 commit b7a19c6

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎electron_app/img/riot.png‎

7.21 KB
Loading

‎electron_app/src/electron-main.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,10 @@ app.on('ready', () => {
295295
console.log('No update_base_url is defined: auto update is disabled');
296296
}
297297

298-
const iconPath = `${__dirname}/../img/riot.${process.platform === 'win32' ? 'ico' : 'png'}`;
298+
// It's important to call `path.join` so we don't end up with the packaged
299+
// asar in the final path.
300+
const iconFile = `riot.${process.platform === 'win32' ? 'ico' : 'png'}`;
301+
const iconPath = path.join(__dirname, "..", "..", "img", iconFile);
299302

300303
// Load the previous window state with fallback to defaults
301304
const mainWindowState = windowStateKeeper({

‎electron_app/src/tray.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ exports.create = function(config) {
6565
global.mainWindow.webContents.on('page-favicon-updated', async function(ev, favicons) {
6666
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith('data:')) {
6767
if (lastFavicon !== null) {
68-
win.setIcon(defaultIcon);
68+
global.mainWindow.setIcon(defaultIcon);
6969
trayIcon.setImage(defaultIcon);
7070
lastFavicon = null;
7171
}

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@
156156
"electronVersion": "4.2.4",
157157
"files": [
158158
"node_modules/**",
159-
"src/**",
160-
"img/**"
159+
"src/**"
161160
],
162161
"extraResources": [
162+
{ "from": "electron_app/img", "to": "img" },
163163
"webapp/**/*",
164164
"origin_migrator/**/*"
165165
],

0 commit comments

Comments
 (0)