From bc735c404d05b6e05aad448cbdbbdde13272a501 Mon Sep 17 00:00:00 2001 From: zyrouge Date: Wed, 27 Sep 2023 07:49:20 +0530 Subject: [PATCH] fix: appimage not relaunching --- src/main/ipc.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/ipc.ts b/src/main/ipc.ts index d1ab771..a88b29c 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -4,7 +4,7 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -import { app, dialog, session, shell } from "electron"; +import { RelaunchOptions, app, dialog, session, shell } from "electron"; import { mkdirSync, readFileSync, watch } from "fs"; import { open, readFile } from "fs/promises"; import { release } from "os"; @@ -19,6 +19,7 @@ import { mainWin } from "./mainWindow"; import { Settings } from "./settings"; import { handle, handleSync } from "./utils/ipcWrappers"; import { isValidVencordInstall } from "./utils/vencordLoader"; +import { execFile } from "child_process"; handleSync(IpcEvents.GET_VENCORD_PRELOAD_FILE, () => join(VENCORD_FILES_DIR, "vencordDesktopPreload.js")); handleSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT, () => @@ -45,7 +46,14 @@ handle(IpcEvents.SET_SETTINGS, (_, settings: typeof Settings.store, path?: strin }); handle(IpcEvents.RELAUNCH, () => { - app.relaunch(); + const options: RelaunchOptions = { + args: process.argv.slice(1).concat(["--relaunch"]), + }; + if (app.isPackaged && process.env.APPIMAGE) { + execFile(process.env.APPIMAGE, options.args); + } else { + app.relaunch(options); + } app.exit(); });