new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

app/login

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

app.getLoginItemSettings() return object structure

The app.getLoginItemSettings() method returns an object with the following properties: openAtLogin (boolean) indicates if the app is set to open at login; wasOpenedAtLogin (boolean, macOS only) is true if the app was opened at login automatically; status (string, macOS only) can be 'not-registered', 'enabled', 'requires-approval', or 'not-found'; executableWillLaunchAtLogin (boolean, Windows only) is true if app is set to open at login and its run key is not deactivated, differing from openAtLogin as it ignores the args option; launchItems (Object array, Windows only) contains registry entries with properties: name (string, Windows), path (string, Windows, the executable path), args (string array, Windows, command-line arguments), scope (string, Windows, either 'user' or 'machine' indicating HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE), and enabled (boolean, Windows, true if the app registry key is startup approved).

app.setLoginItemSettings(settings) method parameters

The app.setLoginItemSettings(settings) method accepts a settings object with the following optional parameters: openAtLogin (boolean, defaults to false) to open the app at login or remove it as a login item; type (string, macOS only, defaults to 'mainAppService') specifying the service type: 'mainAppService' for the primary application, 'agentService' for a launch agent plist in Contents/Library/LaunchAgents, 'daemonService' for a launch daemon plist in Contents/Library/LaunchDaemons, or 'loginItemService' for a login item service plist in Contents/Library/LoginItems; serviceName (string, macOS only, required if type is non-default); path (string, Windows only, defaults to process.execPath) the executable to launch at login; args (string array, Windows only, defaults to empty array) command-line arguments to pass to the executable; enabled (boolean, Windows only, defaults to true) to change the startup approved registry key and enable/disable the app in Task Manager and Windows Settings; name (string, Windows only, defaults to app's AppUserModelId()) the value name to write into registry.

macOS app.setLoginItemSettings() requires code signing and notarization

On macOS, your app should be code signed and notarized for login item settings to work reliably. When an app isn't packaged, code signed, and notarized, openAtLogin may silently fail to take effect.

app.setLoginItemSettings() example with Squirrel auto-updater on Windows

When working with Electron's autoUpdater on Windows using Squirrel, set the launch path to your executable's name but a directory up, which is a stub application automatically generated by Squirrel that will launch the latest version. Example: const { app } = require('electron') const path = require('node:path') const appFolder = path.dirname(process.execPath) const ourExeName = path.basename(process.execPath) const stubLauncher = path.resolve(appFolder, '..', ourExeName) app.setLoginItemSettings({ openAtLogin: true, path: stubLauncher, args: [] })

Give your agent this brain