mirror of
https://github.com/element-hq/element-desktop.git
synced 2026-02-27 19:56:15 -05:00
Fix app name in Windows notifications
Set the App user model ID before running squirrel hooks, as per comment
This commit is contained in:
@@ -46,6 +46,7 @@ import { setupMacosTitleBar } from "./macos-titlebar.js";
|
||||
import { type Json, loadJsonFile } from "./utils.js";
|
||||
import { setupMediaAuth } from "./media-auth.js";
|
||||
import { readBuildConfig } from "./build-config.js";
|
||||
import { checkSquirrelHooks } from "./squirrelhooks.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -53,6 +54,21 @@ const argv = minimist(process.argv, {
|
||||
alias: { help: "h" },
|
||||
});
|
||||
|
||||
const buildConfig = readBuildConfig();
|
||||
|
||||
// This is required to make notification handlers work
|
||||
// on Windows 8.1/10/11 (and is a noop on other platforms);
|
||||
// It must also match the ID found in 'electron-builder'
|
||||
// in order to get the title and icon to show up correctly.
|
||||
// Ref: https://stackoverflow.com/a/77314604/3525780
|
||||
// Must be done before checkSquirrelHooks() as the hook needs
|
||||
// to know what AppUserModelID to set on the shortcut.
|
||||
app.setAppUserModelId(buildConfig.appId);
|
||||
|
||||
if (checkSquirrelHooks()) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (argv["help"]) {
|
||||
console.log("Options:");
|
||||
console.log(" --profile-dir {path}: Path to where to store the profile.");
|
||||
@@ -84,7 +100,6 @@ function isRealUserDataDir(d: string): boolean {
|
||||
return fs.existsSync(path.join(d, "IndexedDB"));
|
||||
}
|
||||
|
||||
const buildConfig = readBuildConfig();
|
||||
const protocolHandler = new ProtocolHandler(buildConfig.protocol);
|
||||
|
||||
// check if we are passed a profile in the SSO callback url
|
||||
@@ -626,9 +641,3 @@ app.on("second-instance", (ev, commandLine, workingDirectory) => {
|
||||
}
|
||||
});
|
||||
|
||||
// This is required to make notification handlers work
|
||||
// on Windows 8.1/10/11 (and is a noop on other platforms);
|
||||
// It must also match the ID found in 'electron-builder'
|
||||
// in order to get the title and icon to show up correctly.
|
||||
// Ref: https://stackoverflow.com/a/77314604/3525780
|
||||
app.setAppUserModelId(buildConfig.appId);
|
||||
|
||||
@@ -28,7 +28,7 @@ function runUpdateExe(args: string[]): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
function checkSquirrelHooks(): boolean {
|
||||
export function checkSquirrelHooks(): boolean {
|
||||
if (process.platform !== "win32") return false;
|
||||
const cmd = process.argv[1];
|
||||
const target = path.basename(process.execPath);
|
||||
@@ -51,7 +51,3 @@ function checkSquirrelHooks(): boolean {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkSquirrelHooks()) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user