diff --git a/src-electron/main.js b/src-electron/main.js index 3b537eb1..a8b497af 100644 --- a/src-electron/main.js +++ b/src-electron/main.js @@ -253,12 +253,28 @@ ipcMain.handle('is-packaged', (event) => { return app.isPackaged; }); -// Get executable path (path to the AppImage on Linux) +// Path to the running Electron binary. On Linux AppImages this is the +// FUSE-mounted binary (/tmp/.mount_*/...), not the .AppImage file — +// use 'get-installed-app-path' if you need the user-visible install path. ipcMain.handle('get-executable-path', (event) => { assertTrusted(event); return process.execPath; }); +// Path of the installed app, or null if not running from an installed build. +// - Linux AppImage: process.env.APPIMAGE (set by AppRun to the .AppImage path) +// - Other / dev / unpacked: null (auto-update not supported yet) +ipcMain.handle('get-installed-app-path', (event) => { + assertTrusted(event); + if (!app.isPackaged) { + return null; + } + if (process.platform === 'linux') { + return process.env.APPIMAGE || null; + } + return null; +}); + // Update scheduled state - shared across windows for multi-window update persistence ipcMain.handle('set-update-scheduled', (event, scheduled) => { assertTrusted(event); diff --git a/src-electron/preload.js b/src-electron/preload.js index 99467063..b818fa0f 100644 --- a/src-electron/preload.js +++ b/src-electron/preload.js @@ -173,6 +173,7 @@ contextBridge.exposeInMainWorld('electronAPI', { getAppVersion: () => ipcRenderer.invoke('get-app-version'), isPackaged: () => ipcRenderer.invoke('is-packaged'), getExecutablePath: () => ipcRenderer.invoke('get-executable-path'), + getInstalledAppPath: () => ipcRenderer.invoke('get-installed-app-path'), setUpdateScheduled: (scheduled) => ipcRenderer.invoke('set-update-scheduled', scheduled), getUpdateScheduled: () => ipcRenderer.invoke('get-update-scheduled') });