Compare commits

..

2 Commits

Author SHA1 Message Date
David Baker
b27af2128c Pwettier 2026-02-27 15:55:27 +01:00
David Baker
7f661a132b Fix app name in Windows notifications
Set the App user model ID before running squirrel hooks, as per comment
2026-02-27 15:51:56 +01:00
2 changed files with 17 additions and 13 deletions

View File

@@ -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
@@ -625,10 +640,3 @@ app.on("second-instance", (ev, commandLine, workingDirectory) => {
global.mainWindow.focus();
}
});
// 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);

View File

@@ -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);
}