new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

autostart

14 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Autostart plugin overview

The autostart plugin automatically launches your Tauri application at system startup. It is available in both JavaScript and Rust.

Autostart JavaScript bindings installation

Install the JavaScript Guest bindings using: npm install @tauri-apps/plugin-autostart (npm), yarn add @tauri-apps/plugin-autostart (yarn), pnpm add @tauri-apps/plugin-autostart (pnpm), deno add npm:@tauri-apps/plugin-autostart (deno), or bun add @tauri-apps/plugin-autostart (bun).

Autostart Rust API

In Rust, access the autostart manager via app.autolaunch(), then call enable() to enable autostart, is_enabled() to check the enabled state, or disable() to disable autostart.

Autostart JavaScript example

```javascript 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 await disable(); ```

Autostart Rust example

```rust #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .setup(|app| { #[cfg(desktop)] { use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_autostart::ManagerExt; app.handle().plugin(tauri_plugin_autostart::init( MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]), )); // Get the autostart manager let autostart_manager = app.autolaunch(); // Enable autostart let _ = autostart_manager.enable(); // Check enable state println!("registered for autostart? {}", autostart_manager.is_enabled().unwrap()); // Disable autostart let _ = autostart_manager.disable(); } Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ```

Autostart MacosLauncher parameter

The autostart plugin initialization requires a MacosLauncher parameter. The example shows using MacosLauncher::LaunchAgent.

Autostart plugin cargo add command

To add the autostart plugin manually to the Cargo.toml in the src-tauri folder, run: cargo add tauri-plugin-autostart --target 'cfg(any(target_os = "macos", windows, target_os = "linux"))'

Autostart plugin initialization in lib.rs

Initialize the autostart plugin in src-tauri/src/lib.rs by calling app.handle().plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]))) within the setup closure. The second parameter accepts an optional vector of arbitrary arguments to pass to your app.

Autostart plugin JavaScript API

The autostart plugin provides three JavaScript functions: enable() to activate autostart, isEnabled() to check the activation status, and disable() to deactivate autostart. Import them from '@tauri-apps/plugin-autostart' or access via window.__TAURI__.autostart if withGlobalTauri is true.

Autostart plugin Rust API

In Rust, use the ManagerExt trait to call app.autolaunch() which returns an autostart_manager. Call autostart_manager.enable() to activate autostart, autostart_manager.is_enabled() to check status, and autostart_manager.disable() to deactivate autostart.

Autostart plugin permissions

The autostart plugin requires three permissions in the capabilities configuration: autostart:allow-enable to enable autostart, autostart:allow-disable to disable autostart, and autostart:allow-is-enabled to check the autostart status.

Autostart plugin automatic installation

The autostart plugin can be installed automatically using the project package manager with commands: npm run tauri add autostart, yarn run tauri add autostart, pnpm tauri add autostart, deno task tauri add autostart, or bun tauri add autostart.

Autostart JavaScript package installation

Install the JavaScript bindings for the autostart plugin using: npm install @tauri-apps/plugin-autostart, yarn add @tauri-apps/plugin-autostart, pnpm add @tauri-apps/plugin-autostart, deno add npm:@tauri-apps/plugin-autostart, or bun add @tauri-apps/plugin-autostart.

Autostart plugin platform support requirement

The autostart plugin is configured to target specific platforms: macOS, Windows, and Linux. Mobile platforms are excluded.

Give your agent this brain