App
App-level capabilities: lifecycle (quit, launch-at-startup), OS permissions, deeplinks, and auto-updates.
The methods on this page span several namespaces (app, permissions, autoUpdate, deeplink). They're grouped here because they concern the app as a whole rather than any one window.
Methods
Exit App
Force closes all windows and quits the app.
await window.deskifier.app.exit()
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.
Launch At Startup
Sets whether the app should automatically launch when the user logs in.
await window.deskifier.app.setLaunchAtStartup({ arguments })
Arguments
launchAtStartupBoolean (Required)
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.
Example
const result = await window.deskifier.app.setLaunchAtStartup({
launchAtStartup: true
});
console.log(result.success); // true
Request Permission
macOS Request use of a certain media type.
Usually, permissions can only be asked once. It's recommended to prompt users with your own UI letting them know to accept the request.
This feature is only available on macOS. Generally, other platforms will have permissions by default.
If needed, you can deep link users to their relevant settings / system preferences.
await window.deskifier.permissions.request({ arguments })
Arguments
permissionString (Required)
Possible values aremicrophone,camera,screenSharing, andaccessiblity. The accessibility value will open the system preferences linked to the accessibility settings, since there's currently no way to request accessibility permissions.
Returns
successBoolean
If access was granted successfully.messageString
Additional confirmation, or error details if action was unsuccessful.
Open System Preferences
macOS Windows Opens the device's settings panel, at the specified submenu.
await window.deskifier.permissions.openSystemPreferences({ arguments })
Arguments
targetString (Required)
Possible values arecamera,microphone,screenSharing,notificationand theaccessibilityvalue is available on macOS only.
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.
Check For Update
Checks to see if there's an app update available.
await window.deskifier.autoUpdate.check()
Returns
successBoolean
If the update was checked.messageString
Additional confirmation, or error details if action was unsuccessful.updateAvailableBoolean
If there is an update available.nextVersionString
Available update version.
Start App Update
This will force close the app.
Starts the app update.
await window.deskifier.autoUpdate.startUpdate()
Returns
successBoolean
Returns false if the update couldn't be started, or if there is no update available.messageString
Additional confirmation, or error details if action was unsuccessful.
Properties
Get Permissions
macOS Windows Returns an object with the current permissions.
Generally, macOS will be the only platform that doesn't have permissions by default. In this case, use the "Request Media Permission" method to gain access to these devices.
You can also deep link users to their relevant settings / system preferences with the "Open System Preferences" method.
await window.deskifier.permissions.getAll()
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.cameraPermissionStatusString
Can benot-determined,granted,denied,restrictedorunknown.microphonePermissionStatusString
Can benot-determined,granted,denied,restrictedorunknown.screenPermissionStatusString
Can benot-determined,granted,denied,restrictedorunknown.accessibilityPermissionStatusString macOS
Can benot-determined,granted,denied,restrictedorunknown. Will returnunknownon platforms other than macOS.notificationPermissionStatusString
Can benot-determined,granted,denied,restrictedorunknown.<br>
Return Value Descriptions:
not-determined- The user has not yet made a choice regarding whether the application may access the data.restricted- The application is not authorized to access the data. The user cannot change this application’s status, possibly due to active restrictions such as parental controls being in place.denied- The user explicitly denied access to data for the application.authorized- The application is authorized to access the data.provisional- The application is provisionally authorized to access the data. Currently only applicable to thenotificationstype.unknown- The permission status can not be determined.
Get App Info
Returns metadata about the running app. This call is Synchronous it returns a value directly (no await).
const info = window.deskifier.app.getAppInfo()
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.launchAtStartupBoolean
If the app is currently set to launch at system startup.launchedWithDeeplinkBoolean
Whether the current instance of the app was launched via a deeplink.deeplinkUrlString
If the app was launched with a deeplink, this will be populated with the URL used. Empty string otherwise.appNameString
Name of the current app.appVersionString
The app version.appDistString
Which distribution the app is currently running as. Can beMAS,DMG,APPX,NSIS,APPIMAGE.willAutoUpdateBoolean
If the app is set to automatically update when a new version is published.
Events
Deeplink Used
Note, a deeplink can be used to launch your application. If this happens, this event will fire when the app starts. You can also check via Get App Info.
Deeplinks may also be used when the app is already running, in this case you should show your application.
Fires when the app's deeplink is used.
window.deskifier.deeplink.onUsed((data) => {})
Arguments
urlString
Example
window.deskifier.deeplink.onUsed((data) => {
console.log(data.url);
});
//yourAppProtocol://data?foo=bar
Update Available
Fires when a new app version is detected. This also fires after a background download completes (check downloaded to distinguish).
window.deskifier.autoUpdate.onAvailable((data) => {})
Arguments
updateAvailableBooleantrueif an update is available.nextVersionString
The version string of the available update (if known).downloadedBooleantrueif the update has finished downloading and is ready to install. Whenfalse, the update is still downloading or not yet started.
Example
window.deskifier.autoUpdate.onAvailable((data) => {
if (data.downloaded) {
// Prompt the user to restart-to-install
showBanner(`${data.nextVersion} is ready. Click to install.`);
} else {
console.log(`Found update ${data.nextVersion}, downloading...`);
}
});
Update Progress
Fires repeatedly during an update download, with progress information.
window.deskifier.autoUpdate.onProgress((data) => {})
Arguments
percentNumber
Download progress percentage (0–100).transferredNumber
Bytes downloaded so far.totalNumber
Total bytes to download.bytesPerSecondNumber
Current download speed.
Update Error
Fires when an update check or download fails.
window.deskifier.autoUpdate.onError((data) => {})
Arguments
messageString
Human-readable error description.