コンテンツにスキップ
Tauri

Autostart(自動起動)

《訳注》

Plugin 説明内容の英語表記部分について Plugin の各章は、原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。

システム起動時にアプリを自動的に起動します。

This plugin requires a Rust version of at least 1.77.2

Platform Level Notes
windows
linux
macos
android
ios

はじめに、「Autostart(自動起動)」プラグインをインストールしてください。

自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します:

npm run tauri add autostart

「Autostart(自動起動)」プラグインは、JavaScript と Rust の両方で利用できます。

import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart';
// `"withGlobalTauri": true` を使用する場合は、
// const { enable, isEnabled, disable } = window.__TAURI__.autostart; を使用できます;
// autostart を有効化
await enable();
// 有効化状態を確認
console.log(`registered for autostart? ${await isEnabled()}`);
// autostart を無効化
disable();

デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、capabilities 設定でアクセス権限を変更する必要があります。

詳細については「セキュリティ・レベル Capabilities」の章を参照してください。また、プラグインのアクセス権限を設定するには「プライグン・アクセス権の使用」の章のステップ・バイ・ステップ・ガイドを参照してください。

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.

【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】


© 2025 Tauri Contributors. CC-BY / MIT