docs: Update Squirrel Run at Login docs to be modern (#44487)
Update Squirrel Run at Login docs to be modern The current docs for setting up Run at Login use the legacy way that Squirrel does shortcuts. This was replaced by an easier method, let's use that instead
This commit is contained in:
parent
7fea537fbf
commit
d9a9d5b8fe
1 changed files with 8 additions and 7 deletions
|
@ -1302,23 +1302,24 @@ Returns `Object`:
|
|||
Set the app's login item settings.
|
||||
|
||||
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
|
||||
you'll want to set the launch path to Update.exe, and pass arguments that specify your
|
||||
application name. For example:
|
||||
you'll want to set the launch path to your executable's name but a directory up, which is
|
||||
a stub application automatically generated by Squirrel which will automatically launch the
|
||||
latest version.
|
||||
|
||||
``` js
|
||||
const { app } = require('electron')
|
||||
const path = require('node:path')
|
||||
|
||||
const appFolder = path.dirname(process.execPath)
|
||||
const updateExe = path.resolve(appFolder, '..', 'Update.exe')
|
||||
const exeName = path.basename(process.execPath)
|
||||
const ourExeName = path.basename(process.execPath)
|
||||
const stubLauncher = path.resolve(appFolder, '..', ourExeName)
|
||||
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: true,
|
||||
path: updateExe,
|
||||
path: stubLauncher,
|
||||
args: [
|
||||
'--processStart', `"${exeName}"`,
|
||||
'--process-start-args', '"--hidden"'
|
||||
// You might want to pass a parameter here indicating that this
|
||||
// app was launched via login, but you don't have to
|
||||
]
|
||||
})
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue