chore: prep for flatpak
This commit is contained in:
parent
894ec4b902
commit
bb09596485
1 changed files with 15 additions and 5 deletions
|
@ -15,15 +15,19 @@ interface AutoStart {
|
|||
disable(): void;
|
||||
}
|
||||
|
||||
const isFlatpak = process.env.FLATPAK_ID !== undefined;
|
||||
|
||||
function makeAutoStartLinux(): AutoStart {
|
||||
const configDir = process.env.XDG_CONFIG_HOME || join(process.env.HOME!, ".config");
|
||||
const dir = join(configDir, "autostart");
|
||||
const file = join(dir, "vencord.desktop");
|
||||
|
||||
return {
|
||||
isEnabled: () => existsSync(file),
|
||||
isEnabled: () => existsSync(file), // TODO: flatpak
|
||||
wasAutoStarted: () => process.argv.includes("--autostart"),
|
||||
enable() {
|
||||
if (isFlatpak) {
|
||||
} else {
|
||||
const desktopFile = `
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
|
@ -37,8 +41,14 @@ StartupNotify=false
|
|||
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(file, desktopFile);
|
||||
}
|
||||
},
|
||||
disable: () => rmSync(file, { force: true })
|
||||
disable: () => {
|
||||
if (isFlatpak) {
|
||||
} else {
|
||||
rmSync(file, { force: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue