Skip to content
Tauri

Autostart

Automatically launch your application at system startup.

Supported Platforms

  • Windows
  • Mac (via AppleScript or Launch Agent)
  • Linux

Setup

Install the autostart plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add autostart

Usage

The autostart plugin is available in both JavaScript and Rust.

import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart';
// Enable autostart
await enable();
// Check enable state
console.log(`registered for autostart? ${await isEnabled()}`);
// Disable autostart
disable();

Permissions

By default all plugin commands are blocked and cannot be accessed. You must define a list of permissions in your capabilities configuration.

See Permissions Overview for more information.

src-tauri/capabilities/main.json
{
"permissions": [
...,
"autostart:allow-enable",
"autostart:allow-disable",
"autostart:allow-is-enabled"
]
}
PermissionDescription
autostart:allow-disableEnables the disable command without any pre-configured scope.
autostart:deny-disableDenies the disable command without any pre-configured scope.
autostart:allow-enableEnables the enable command without any pre-configured scope.
autostart:deny-enableDenies the enable command without any pre-configured scope.
autostart:allow-is-enabledEnables the is_enabled command without any pre-configured scope.
autostart:deny-is-enabledDenies the is_enabled command without any pre-configured scope.

© 2024 Tauri Contributors. CC-BY / MIT