ExTauri.Autostart (ex_tauri v0.2.0)

View Source

Control launch-at-login from your LiveView.

Bridges to tauri-plugin-autostart via the LiveView hook.

Plugin Setup

mix ex_tauri.add autostart

Examples

# A settings toggle
def handle_event("toggle_autostart", %{"enabled" => "true"}, socket) do
  {:noreply, ExTauri.Autostart.enable(socket)}
end

def handle_event("toggle_autostart", _params, socket) do
  {:noreply, ExTauri.Autostart.disable(socket)}
end

# Read the current state when the settings page mounts
def handle_event("load_settings", _params, socket) do
  {:noreply, ExTauri.Autostart.status(socket)}
end

def handle_event("tauri_response", %{"command" => "autostart_status", "enabled" => enabled}, socket) do
  {:noreply, assign(socket, :autostart_enabled, enabled)}
end

Summary

Functions

Disables launching the app at login.

Enables launching the app at login.

Queries whether launch-at-login is enabled.

Functions

disable(socket, on_reply \\ nil)

Disables launching the app at login.

enable(socket, on_reply \\ nil)

Enables launching the app at login.

status(socket, on_reply \\ nil)

Queries whether launch-at-login is enabled.

The result arrives as a "tauri_response" event with %{"command" => "autostart_status", "enabled" => true | false}.