mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
use snoretoast CLSID
This commit is contained in:
14
index.js
14
index.js
@ -363,6 +363,9 @@ app.on("ready", () => {
|
||||
|
||||
// Register appID on windows
|
||||
if (is.windows()) {
|
||||
// Depends on SnoreToast version https://github.com/KDE/snoretoast/blob/master/CMakeLists.txt#L5
|
||||
const toastActivatorClsid = "eb1fdd5b-8f70-4b5a-b230-998a2dc19303";
|
||||
|
||||
const appID = "com.github.th-ch.youtube-music";
|
||||
app.setAppUserModelId(appID);
|
||||
const appLocation = process.execPath;
|
||||
@ -372,7 +375,11 @@ app.on("ready", () => {
|
||||
const shortcutPath = path.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "YouTube Music.lnk");
|
||||
try { // check if shortcut is registered and valid
|
||||
const shortcutDetails = electron.shell.readShortcutLink(shortcutPath); // throw error if doesn't exist yet
|
||||
if (shortcutDetails.target !== appLocation || shortcutDetails.appUserModelId !== appID) {
|
||||
if (
|
||||
shortcutDetails.target !== appLocation ||
|
||||
shortcutDetails.appUserModelId !== appID ||
|
||||
shortcutDetails.toastActivatorClsid !== toastActivatorClsid
|
||||
) {
|
||||
throw "needUpdate";
|
||||
}
|
||||
} catch (error) { // if not valid -> Register shortcut
|
||||
@ -381,9 +388,10 @@ app.on("ready", () => {
|
||||
error === "needUpdate" ? "update" : "create",
|
||||
{
|
||||
target: appLocation,
|
||||
cwd: appLocation.slice(0, appLocation.lastIndexOf(path.sep)),
|
||||
cwd: path.dirname(appLocation),
|
||||
description: "YouTube Music Desktop App - including custom plugins",
|
||||
appUserModelId: appID
|
||||
appUserModelId: appID,
|
||||
toastActivatorClsid
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user