From ed23f6d5fdd6d3a660533e826622c2f5fbb9a616 Mon Sep 17 00:00:00 2001 From: RubenKelevra Date: Fri, 13 Feb 2026 15:46:07 +0100 Subject: [PATCH] autostart: include app path when launched via electron --- src/auto-launch.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/auto-launch.js b/src/auto-launch.js index 89588efc9..111a95021 100644 --- a/src/auto-launch.js +++ b/src/auto-launch.js @@ -21,6 +21,25 @@ function getDesktopFile () { return path.join(untildify('~/.config/autostart/'), 'ipfs-desktop.desktop') } +function quoteDesktopEntryArg (value) { + return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"` +} + +function getLinuxAutostartExec () { + const command = [process.execPath] + + // Some distro packages launch as `electron `. + if (path.basename(process.execPath).startsWith('electron')) { + const appPath = app.getAppPath() + + if (appPath && appPath !== process.execPath) { + command.push(appPath) + } + } + + return command.map(quoteDesktopEntryArg).join(' ') +} + async function enable () { if (app.setLoginItemSettings && (IS_MAC || IS_WIN)) { app.setLoginItemSettings({ openAtLogin: true }) @@ -32,7 +51,7 @@ Type=Application Version=1.0 Name=IPFS Desktop Comment=IPFS Desktop Startup Script -Exec="${process.execPath}" +Exec=${getLinuxAutostartExec()} Icon=ipfs-desktop StartupNotify=false Terminal=false`