diff --git a/build/icons/512x512.png b/build/icon.png similarity index 100% rename from build/icons/512x512.png rename to build/icon.png diff --git a/build/icons/128x128.png b/build/icons/128x128.png deleted file mode 100644 index cd56d778..00000000 Binary files a/build/icons/128x128.png and /dev/null differ diff --git a/build/icons/16x16.png b/build/icons/16x16.png deleted file mode 100644 index d212ecd8..00000000 Binary files a/build/icons/16x16.png and /dev/null differ diff --git a/build/icons/24x24.png b/build/icons/24x24.png deleted file mode 100644 index 573e2680..00000000 Binary files a/build/icons/24x24.png and /dev/null differ diff --git a/build/icons/256x256.png b/build/icons/256x256.png deleted file mode 100644 index 4e6c4f56..00000000 Binary files a/build/icons/256x256.png and /dev/null differ diff --git a/build/icons/48x48.png b/build/icons/48x48.png deleted file mode 100644 index 5f746a96..00000000 Binary files a/build/icons/48x48.png and /dev/null differ diff --git a/build/icons/64x64.png b/build/icons/64x64.png deleted file mode 100644 index 9d4039bf..00000000 Binary files a/build/icons/64x64.png and /dev/null differ diff --git a/build/icons/96x96.png b/build/icons/96x96.png deleted file mode 100644 index b80fa9f2..00000000 Binary files a/build/icons/96x96.png and /dev/null differ diff --git a/electron-builder.ts b/electron-builder.ts index 3e4e3928..d2fd5370 100644 --- a/electron-builder.ts +++ b/electron-builder.ts @@ -82,13 +82,7 @@ const config: Omit, "electronFuses"> & { }, "lib/**", ], - extraResources: [ - { - from: "res/img", - to: "img", - }, - "webapp.asar", - ], + extraResources: ["build/icon.*", "webapp.asar"], extraMetadata: { name: pkg.name, productName: pkg.productName, @@ -99,7 +93,7 @@ const config: Omit, "electronFuses"> & { linux: { target: ["tar.gz", "deb"], category: "Network;InstantMessaging;Chat", - icon: "build/icons", + icon: "build/icon.png", executableName: pkg.name, // element-desktop or element-desktop-nightly }, deb: { @@ -128,7 +122,7 @@ const config: Omit, "electronFuses"> & { // XXX: we cannot specify this due to https://github.com/electron/osx-sign/issues/344 // strictVerify: true, entitlements: "./build/entitlements.mac.plist", - icon: "build/icons/icon.icns", + icon: "build/icon.icns", mergeASARs: true, x64ArchFiles: "**/matrix-seshat/*.node", // hak already runs lipo }, @@ -137,7 +131,7 @@ const config: Omit, "electronFuses"> & { signtoolOptions: { signingHashAlgorithms: ["sha256"], }, - icon: "build/icons/icon.ico", + icon: "build/icon.ico", }, msi: { perMachine: true, diff --git a/res/img/element.ico b/res/img/element.ico deleted file mode 100644 index d80c6c5b..00000000 Binary files a/res/img/element.ico and /dev/null differ diff --git a/res/img/element.png b/res/img/element.png deleted file mode 100644 index 4e6c4f56..00000000 Binary files a/res/img/element.png and /dev/null differ diff --git a/src/electron-main.ts b/src/electron-main.ts index ffb893c1..6d8e401b 100644 --- a/src/electron-main.ts +++ b/src/electron-main.ts @@ -233,19 +233,10 @@ async function setupGlobals(): Promise { const asarPath = await getAsarPath(); await loadConfig(); - // we assume the resources path is in the same place as the asar - const resPath = await tryPaths("res", path.dirname(asarPath), [ - // If run from the source checkout - "res", - // if run from packaged application - "", - ]); - - // The tray icon - // It's important to call `path.join` so we don't end up with the packaged asar in the final path. - const iconFile = `element.${process.platform === "win32" ? "ico" : "png"}`; + // Figure out the tray icon path & brand name + const iconFile = `icon.${process.platform === "win32" ? "ico" : "png"}`; global.trayConfig = { - icon_path: path.join(resPath, "img", iconFile), + icon_path: path.join(path.dirname(asarPath), "build", iconFile), brand: global.vectorConfig.brand || "Element", }; diff --git a/src/tray.ts b/src/tray.ts index 0e906fb6..94deec35 100644 --- a/src/tray.ts +++ b/src/tray.ts @@ -38,18 +38,13 @@ function toggleWin(): void { } } -interface IConfig { - icon_path: string; // eslint-disable-line camelcase - brand: string; -} - function getUuid(): string { // The uuid field is optional and only needed on unsigned Windows packages where the executable path changes // The hardcoded uuid is an arbitrary v4 uuid generated on https://www.uuidgenerator.net/version4 return global.vectorConfig["uuid"] || "eba84003-e499-4563-8e9d-166e34b5cc25"; } -export function create(config: IConfig): void { +export function create(config: (typeof global)["trayConfig"]): void { // no trays on darwin if (process.platform === "darwin" || trayIcon) return; const defaultIcon = nativeImage.createFromPath(config.icon_path);