πŸš€
Launch at Startup (macOS, Windows only)

What is Launch at Startup?

This option lets you specify whether your desktop app should launch when a user starts their computer.
By default, this is disabled for Desktop apps and enabled for Menubar apps.
​

Enabling Launch at Startup

In your Edit app page, simply check the Launch at Startup By Default checkbox under App Options:
App Options panel for toggling Launch at Startup by Default
If enabled, your desktop app will now launch by default when a user starts up their computer.
Your users will always have an option to toggle this setting on or off in their native app menus (application menu and menubar/tray menu).
​

Using the Javascript API

We expose a launchSettings object and two helper methods if you wish to add custom logic to your app.

Get Launch Settings

window.todesktop.app.getLaunchSettings() returns a promise which resolves to a launchSettings object. This object has the following attributes:
Attribute
Type
Description
willLaunchAtStartup
boolean
The user's current setting for launching the app at startup.
1
const launchSettings = await window.todesktop.app.getLaunchSettings()
2
​
3
console.log(launchSettings);
4
// {
5
// willLaunchAtStartup: true
6
// }
Copied!

​

Set Launch Settings

window.todesktop.app.setLaunchSettings(launchSettings) allows you to update a user's launch settings.
1
/*
2
sets the value of willLaunchAtStartup to true
3
*/
4
​
5
window.todesktop.app.setLaunchSettings({
6
willLaunchAtStartup: true
7
})
Copied!

​

Full example

The following is an example of how to toggle the status of Launch at Startup if a user clicks on a button.
1
button.addEventListener('click', () => {
2
​
3
// Gets the launch settings object
4
const { willLaunchAtStartup } = await window.todesktop.app.getLaunchSettings()
5
6
// toggles the value of will launch at startup
7
window.todesktop.app.setLaunchSettings({
8
willLaunchAtStartup: !willLaunchAtStartup
9
})
10
})
11
Copied!
​
You can learn more about our JavaScript API through the link below:
Last modified 1yr ago