Aller au contenu
Tauri

Autostart

Lancez automatiquement votre application au démarrage du système.

This plugin requires a Rust version of at least 1.77.2

Platform Level Notes
windows
linux
macos
android
ios

Installez le plugin autostart pour commencer.

Utilisez le gestionnaire de paquets de votre projet pour ajouter la dépendance :

npm run tauri add autostart

Le plugin autostart est disponible en JavaScript et en Rust.

import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart';
// lors de l'utilisation de `"withGlobalTauri": true`, vous pouvez utiliser
// const { enable, isEnabled, disable } = window.__TAURI__.autostart;
// Activer le démarrage automatique
await enable();
// Vérifier l'état d'activation
console.log(`registered for autostart? ${await isEnabled()}`);
// Désactiver le démarrage automatique
disable();

Par défaut, toutes les commandes et portées de plugin potentiellement dangereuses sont bloquées et inaccessibles. Vous devez modifier les permissions dans votre configuration capabilities pour les activer.

Consultez la Vue d’ensemble des capacités pour plus d’informations et le guide étape par étape pour utiliser les permissions de plugin.

src-tauri/capabilities/default.json
{
"permissions": [
...,
"autostart:allow-enable",
"autostart:allow-disable",
"autostart:allow-is-enabled"
]
}

Default Permission

This permission set configures if your application can enable or disable auto starting the application on boot.

Granted Permissions

It allows all to check, enable and disable the automatic start on boot.

This default permission set includes the following:

  • allow-enable
  • allow-disable
  • allow-is-enabled

Permission Table

Identifier Description

autostart:allow-disable

Enables the disable command without any pre-configured scope.

autostart:deny-disable

Denies the disable command without any pre-configured scope.

autostart:allow-enable

Enables the enable command without any pre-configured scope.

autostart:deny-enable

Denies the enable command without any pre-configured scope.

autostart:allow-is-enabled

Enables the is_enabled command without any pre-configured scope.

autostart:deny-is-enabled

Denies the is_enabled command without any pre-configured scope.


© 2025 Tauri Contributors. CC-BY / MIT