### Install Dependencies and Build Packages (Bash) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/examples/api/README.md Installs project dependencies using pnpm and builds the necessary packages. This command should be executed from the repository root directory. ```bash pnpm install pnpm build ``` -------------------------------- ### Rust Usage Examples Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/README.md Examples demonstrating how to use the opener plugin's Rust APIs within the `setup` function of your Tauri application. This allows programmatic control over opening URLs, paths, and revealing items. ```rust use tauri_plugin_opener::OpenerExt; fn main() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) .setup(|app| { let opener = app.opener(); // Opens the URL in the default browser opener.open_url("https://example.com", None::<&str>)?; // Or with a specific browser/app opener.open_url("https://example.com", Some("firefox"))?; // Opens the path with the system's default app opener.open_path("/path/to/file", None::<&str>)?; // Or with a specific app opener.open_path("/path/to/file", Some("firefox"))?; // Reveal a path with the system's default explorer opener.reveal_item_in_dir("/path/to/file")?; // Reveal multiple paths with the system's default explorer opener.reveal_items_in_dir(["/path/to/file"])?; Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` -------------------------------- ### Run App in Development Mode (Bash) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/examples/api/README.md Starts the Tauri application in development mode. This command should be executed from the `examples/api/` directory within the repository. ```bash pnpm tauri dev ``` -------------------------------- ### Install JavaScript Guest Bindings Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/upload/README.md Install the JavaScript guest bindings for the upload plugin using your preferred package manager. ```sh pnpm add @tauri-apps/plugin-upload # or npm add @tauri-apps/plugin-upload # or yarn add @tauri-apps/plugin-upload ``` -------------------------------- ### Install HTTP Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/README.md Install the JavaScript guest bindings for the HTTP plugin using your preferred package manager. ```sh pnpm add @tauri-apps/plugin-http # or npm add @tauri-apps/plugin-http # or yarn add @tauri-apps/plugin-http ``` -------------------------------- ### Install Tauri Plugin Opener (Cargo.toml) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/README.md Add the opener plugin to your project's Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-opener = "2.0.0" # alternatively with Git: tauri-plugin-opener = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install JavaScript Guest Bindings Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/README.md Install the JavaScript guest bindings for the opener plugin using your preferred package manager. This makes the plugin's APIs available in your frontend code. ```sh pnpm add @tauri-apps/plugin-opener # or npm add @tauri-apps/plugin-opener # or yarn add @tauri-apps/plugin-opener ``` -------------------------------- ### JavaScript Usage Examples Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/README.md Examples demonstrating how to use the opener plugin's JavaScript APIs to open URLs, paths, and reveal items in their directories. Supports opening with default or specific applications. ```javascript import { openUrl, openPath, revealItemInDir } from '@tauri-apps/plugin-opener' // Opens the URL in the default browser await openUrl('https://example.com') // Or with a specific browser/app await openUrl('https://example.com', 'firefox') // Opens the path with the system's default app await openPath('/path/to/file') // Or with a specific app await openPath('/path/to/file', 'firefox') // Reveal a path with the system's default explorer await revealItemInDir('/path/to/file') // Reveal multiple paths with the system's default explorer // Note: will be renamed to `revealItemsInDir` in the next major version await revealItemInDir(['/path/to/file', '/path/to/another/file']) ``` -------------------------------- ### Install Tauri Plugin Window State (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/window-state/README.md Installs the core Tauri plugin for window state management by adding it as a dependency in the Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-window-state = "2.0.0" # alternatively with Git: tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install HTTP Plugin (Cargo.toml) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/README.md Add the HTTP plugin to your project's Cargo.toml file. You can use the crates.io version or install directly from GitHub. ```toml [dependencies] tauri-plugin-http = "2.0.0" # alternatively with Git: tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin Store (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/store/README.md Install the JavaScript guest bindings for the Tauri plugin store using your preferred package manager. ```sh pnpm add @tauri-apps/plugin-store # or npm add @tauri-apps/plugin-store # or yarn add @tauri-apps/plugin-store ``` -------------------------------- ### Install Tauri Haptics Plugin (Cargo.toml) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/README.md Installs the Tauri Haptics core plugin by adding it as a dependency in your Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-haptics = "2.0.0" # alternatively with Git: tauri-plugin-haptics = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin Single Instance with Cargo.toml Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/single-instance/README.md Demonstrates how to add the tauri-plugin-single-instance to your project's Cargo.toml file. It shows installation from crates.io and alternatively from a Git repository. ```toml [dependencies] tauri-plugin-single-instance = "2.0.0" # alternatively with Git: tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin Positioner (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/positioner/README.md Install the JavaScript guest bindings for the Tauri plugin positioner using your preferred package manager. ```sh pnpm add @tauri-apps/plugin-positioner # or npm add @tauri-apps/plugin-positioner # or yarn add @tauri-apps/plugin-positioner ``` -------------------------------- ### Install Tauri Plugin Dialog JavaScript Bindings Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/dialog/README.md Install the JavaScript guest bindings for the Tauri plugin dialog using npm, pnpm, or yarn. ```sh pnpm add @tauri-apps/plugin-dialog # or npm add @tauri-apps/plugin-dialog # or yarn add @tauri-apps/plugin-dialog ``` -------------------------------- ### Build and Run Release App (Bash) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/examples/api/README.md Builds the release version of the Tauri application and then runs the executable. These commands should be executed from the `examples/api/` directory. ```bash pnpm tauri build ./src-tauri/target/release/app ``` -------------------------------- ### Install Tauri Plugin Autostart Guest Bindings (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/autostart/README.md Instructions for installing the JavaScript guest bindings for the Tauri plugin autostart using popular package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-autostart # or npm add @tauri-apps/plugin-autostart # or yarn add @tauri-apps/plugin-autostart ``` -------------------------------- ### Install JavaScript Guest Bindings for Clipboard Manager Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/README.md Install the JavaScript guest bindings for the clipboard manager plugin using your preferred JavaScript package manager. ```sh pnpm add @tauri-apps/plugin-clipboard-manager # or npm add @tauri-apps/plugin-clipboard-manager # or yarn add @tauri-apps/plugin-clipboard-manager ``` -------------------------------- ### Install JavaScript Guest Bindings Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/README.md Commands to install the JavaScript guest bindings for the Tauri SQL plugin using common JavaScript package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-sql # or npm add @tauri-apps/plugin-sql # or yarn add @tauri-apps/plugin-sql ``` -------------------------------- ### Install Tauri Plugin Autostart Core (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/autostart/README.md This snippet shows how to add the Tauri plugin autostart to your Rust project's Cargo.toml file. It supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-autostart = "2.0.0" # alternatively with Git: tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin Log (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/log/README.md Installs the JavaScript Guest bindings for the Tauri Plugin Log using common JavaScript package managers. ```sh pnpm add @tauri-apps/plugin-log # or npm add @tauri-apps/plugin-log # or yarn add @tauri-apps/plugin-log ``` -------------------------------- ### Install JavaScript Guest Bindings (npm/pnpm/yarn) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/stronghold/README.md These commands demonstrate how to install the JavaScript Guest bindings for the Tauri Plugin Stronghold using popular JavaScript package managers like pnpm, npm, and yarn. ```sh pnpm add @tauri-apps/plugin-stronghold # or npm add @tauri-apps/plugin-stronghold # or yarn add @tauri-apps/plugin-stronghold ``` -------------------------------- ### Install Tauri Plugin Shell (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/shell/README.md Install the JavaScript Guest bindings for the Tauri plugin shell using your preferred package manager. ```sh pnpm add @tauri-apps/plugin-shell # or npm add @tauri-apps/plugin-shell # or yarn add @tauri-apps/plugin-shell ``` -------------------------------- ### Install JavaScript Guest Bindings for Tauri WebSocket Plugin Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/README.md Illustrates the command-line instructions for installing the JavaScript guest bindings for the Tauri WebSocket plugin using popular package managers like pnpm, npm, and yarn. ```sh pnpm add @tauri-apps/plugin-websocket # or npm add @tauri-apps/plugin-websocket # or yarn add @tauri-apps/plugin-websocket ``` -------------------------------- ### Install Tauri Plugin Store (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/store/README.md Add the Tauri plugin store to your Rust project's Cargo.toml. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-store = "2.0.0" # alternatively with Git: tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri OS Plugin Guest Bindings (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/README.md Commands to install the JavaScript guest bindings for the Tauri OS plugin using popular package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-os # or npm add @tauri-apps/plugin-os # or yarn add @tauri-apps/plugin-os ``` -------------------------------- ### Install Tauri OS Plugin (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/README.md Instructions for adding the Tauri OS plugin to your Rust project's Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-os = "2.0.0" # alternatively with Git: tauri-plugin-os = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin CLI (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/cli/README.md Installs the JavaScript Guest bindings for the Tauri Plugin CLI using common package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-cli # or npm add @tauri-apps/plugin-cli # or yarn add @tauri-apps/plugin-cli ``` -------------------------------- ### Install Tauri Plugin Window State (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/window-state/README.md Installs the JavaScript guest bindings for the Tauri window state plugin using common package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-window-state # or npm add @tauri-apps/plugin-window-state # or yarn add @tauri-apps/plugin-window-state ``` -------------------------------- ### Install Tauri Plugin Process (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/process/README.md Install the JavaScript Guest bindings for the Tauri plugin-process using a package manager like pnpm, npm, or yarn. This makes the plugin's APIs available in your frontend code. ```sh pnpm add @tauri-apps/plugin-process # or npm add @tauri-apps/plugin-process # or yarn add @tauri-apps/plugin-process ``` -------------------------------- ### Install Tauri Plugin Stronghold (Cargo.toml) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/stronghold/README.md This snippet shows how to add the Tauri Plugin Stronghold to your project's Cargo.toml file. It includes the standard crates.io installation and an alternative method using a Git repository. ```toml [dependencies] tauri-plugin-stronghold = "2.0.0" # alternatively with Git: tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install JavaScript Guest Bindings (npm/yarn) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/README.md Installs the necessary JavaScript guest bindings for the barcode scanner plugin using common package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-barcode-scanner # or npm add @tauri-apps/plugin-barcode-scanner # or yarn add @tauri-apps/plugin-barcode-scanner ``` -------------------------------- ### Install Tauri File System Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/fs/README.md Install the JavaScript Guest bindings for the Tauri File System plugin using your preferred package manager. This makes the plugin's APIs available in your frontend JavaScript code. ```sh pnpm add @tauri-apps/plugin-fs # or npm add @tauri-apps/plugin-fs # or yarn add @tauri-apps/plugin-fs ``` -------------------------------- ### Install Tauri Plugin Localhost in Cargo.toml Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/localhost/README.md This snippet shows how to add the tauri-plugin-localhost to your project's Cargo.toml file. It includes options for installing from crates.io or directly from GitHub using git tags or revision hashes. The `portpicker` crate is also shown for selecting a free port. ```toml [dependencies] portpicker = "0.1" # used in the example to pick a random free port tauri-plugin-localhost = "2.0.0" # alternatively with Git: tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri NFC Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/README.md Install the JavaScript Guest bindings for the Tauri NFC plugin using your preferred package manager. This makes the plugin's APIs available in your frontend code. ```sh pnpm add @tauri-apps/plugin-nfc # or npm add @tauri-apps/plugin-nfc # or yarn add @tauri-apps/plugin-nfc ``` -------------------------------- ### Handle Tray Events (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/positioner/README.md Example of handling tray icon events in JavaScript, including updating the icon state and moving the window relative to the tray. ```javascript import { moveWindow, Position, handleIconState, } from "@tauri-apps/plugin-positioner"; const action = async (event: TrayIconEvent) => { // add the handle in the action to update the state await handleIconState(event); if (event.type === "Click") { // note this option requires enabling the `tray-icon` // feature in the Cargo.toml await moveWindow(Position.TrayLeft); } }; const tray = await TrayIcon.new({ id: "main", action }); ``` -------------------------------- ### Install Tauri Geolocation Plugin (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/geolocation/README.md Installs the core Tauri Geolocation plugin by adding it as a dependency in the Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-geolocation = "2.0.0" # alternatively with Git: tauri-plugin-geolocation = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Use Tauri Plugin Autostart APIs (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/autostart/README.md Example of using the JavaScript guest bindings for the Tauri plugin autostart to enable, check the status of, and disable the autostart functionality. ```javascript import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart' await enable() console.log(`registered for autostart? ${await isEnabled()}`) disable() ``` -------------------------------- ### Connect to WebSocket Server using JavaScript Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/README.md Provides a JavaScript example of how to connect to a WebSocket server using the Tauri WebSocket plugin's guest bindings. It demonstrates establishing a connection, sending a message, and disconnecting. ```javascript import WebSocket from '@tauri-apps/plugin-websocket' const ws = await WebSocket.connect('wss://example.com') await ws.send('Hello World') await ws.disconnect() ``` -------------------------------- ### Register Tauri Plugin Autostart in Rust Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/autostart/README.md This Rust code demonstrates how to register the autostart plugin with your Tauri application during initialization. It shows how to configure optional arguments and the application name. ```rust fn main() { tauri::Builder::default() .plugin(tauri_plugin_autostart::Builder::new() .args(["--flag1", "--flag2"]) .app_name("My Custom Name") .build()) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` -------------------------------- ### Install Tauri Plugin Shell (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/shell/README.md Add the Tauri plugin shell to your Rust project's Cargo.toml file. You can install it from crates.io or directly from GitHub. ```toml [dependencies] tauri-plugin-shell = "2.0.0" # alternatively with Git: tauri-plugin-shell = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin Positioner (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/positioner/README.md Add the Tauri plugin positioner to your Rust project's Cargo.toml. You can install it from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-positioner = "2.0.0" # alternatively with Git: tauri-plugin-positioner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Plugin PLUGIN_NAME (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/shared/template/README.md Install the JavaScript Guest bindings for the PLUGIN_NAME plugin using your preferred JavaScript package manager (pnpm, npm, or yarn). ```sh pnpm add @tauri-apps/plugin-PLUGIN_NAME # or npm add @tauri-apps/plugin-PLUGIN_NAME # or yarn add @tauri-apps/plugin-PLUGIN_NAME ``` -------------------------------- ### Tauri Plugin Store Usage from Rust Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/store/README.md Demonstrates creating and interacting with a Tauri plugin store directly within a Rust setup function. Values must be `serde_json::Value` for JavaScript interoperability. ```rust use tauri_plugin_store::StoreExt; use serde_json::json; fn main() { tauri::Builder::default() .plugin(tauri_plugin_store::Builder::default().build()) .setup(|app| { // This loads the store from disk let store = app.store("app_data.json")?; // Note that values must be serde_json::Value instances, // otherwise, they will not be compatible with the JavaScript bindings. store.set("a".to_string(), json!("b")); Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` -------------------------------- ### Install Tauri Plugin Log (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/log/README.md Adds the Tauri Plugin Log to your Rust project's dependencies. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-log = "2.0.0" # alternatively with Git: tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Geolocation Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/geolocation/README.md Installs the JavaScript Guest bindings for the Tauri Geolocation plugin using common package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-geolocation # or npm add @tauri-apps/plugin-geolocation # or yarn add @tauri-apps/plugin-geolocation ``` -------------------------------- ### Install Tauri Biometric Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/biometric/README.md Install the JavaScript guest bindings for the Tauri Biometric plugin using your preferred package manager (pnpm, npm, or yarn). ```sh pnpm add @tauri-apps/plugin-biometric # or npm add @tauri-apps/plugin-biometric # or yarn add @tauri-apps/plugin-biometric ``` -------------------------------- ### Install Tauri Plugin PLUGIN_NAME (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/shared/template/README.md Add the PLUGIN_NAME plugin to your Tauri project's Cargo.toml file. You can install it from crates.io or directly from GitHub using a specific branch. ```toml [dependencies] tauri-plugin-PLUGIN_NAME = "2.0.0" # alternatively with Git: tauri-plugin-PLUGIN_NAME = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Make HTTP Request (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/README.md Use the `fetch` API from the JavaScript guest bindings to make an HTTP request. You can configure request methods, headers, and timeouts. ```javascript import { fetch } from '@tauri-apps/plugin-http' const response = await fetch('http://localhost:3003/users/2', { method: 'GET', connectTimeout: 30 }) ``` -------------------------------- ### Install Tauri Plugin Dialog (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/dialog/README.md Add the Tauri plugin dialog to your Rust project's Cargo.toml file. Supports installation from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-dialog = "2.0.0" # alternatively with Git: tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Tauri Plugin Stronghold Usage (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/stronghold/README.md This JavaScript code demonstrates how to use the Tauri Plugin Stronghold's guest bindings. It covers loading a vault, creating or loading a client, storing and retrieving data, and saving updates. ```javascript import { Stronghold, Location, Client } from "tauri-plugin-stronghold-api"; import { appDataDir } from "@tauri-apps/api/path"; const initStronghold = async () => { const vaultPath = `${await appDataDir()}/vault.hold`; const vaultKey = "The key to the vault"; const stronghold = await Stronghold.load(vaultPath, vaultKey); let client: Client; const clientName = "name your client"; try { client = await hold.loadClient(clientName); } catch { client = await hold.createClient(clientName); } return { stronghold, client, }; }; const { stronghold, client } = await initStronghold(); const store = client.getStore(); const key = "my_key"; // Insert a record to the store const data = Array.from(new TextEncoder().encode("Hello, World!")); await store.insert(key, data); // Read a record from store const data = await store.get(key); const value = new TextDecoder().decode(new Uint8Array(data)); // Save your updates await stronghold.save(); // Remove a record from store await store.remove(key); ``` -------------------------------- ### Install Tauri Clipboard Manager Plugin (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/clipboard-manager/README.md Add the clipboard manager plugin to your Tauri project's Cargo.toml file. You can install it from crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-clipboard-manager = "2.0.0" # alternatively with Git: tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Use Tauri Plugin Process APIs (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/process/README.md Utilize the JavaScript guest bindings for the Tauri plugin-process to interact with the application's process. This example shows how to exit the application with a status code and how to relaunch it. ```javascript import { exit, relaunch } from '@tauri-apps/plugin-process' // exit the app with the given status code await exit(0) // restart the app await relaunch() ``` -------------------------------- ### Install Tauri Notification Plugin (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/README.md Commands to install the JavaScript guest bindings for the Tauri Notification plugin using popular package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-notification # or npm add @tauri-apps/plugin-notification # or yarn add @tauri-apps/plugin-notification ``` -------------------------------- ### Apply Migrations on Initialization (JSON) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/README.md Configure the Tauri SQL plugin to apply migrations by specifying the connection string in the `tauri.conf.json` file under the `plugins.sql.preload` array. This ensures migrations run when the plugin is initialized. ```json { "plugins": { "sql": { "preload": ["sqlite:mydatabase.db"] } } } ``` -------------------------------- ### Install Tauri Notification Plugin (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/README.md Instructions for adding the Tauri Notification plugin to your Rust project's Cargo.toml file. Supports installation via crates.io or directly from a Git repository. ```toml [dependencies] tauri-plugin-notification = "2.0.0" # alternatively with Git: tauri-plugin-notification = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Basic Usage of Tauri Plugin Store (JavaScript) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/store/README.md Demonstrates basic usage of the Tauri plugin store in JavaScript, including loading, setting, and getting values. Modifications are automatically saved. ```typescript import { Store } from '@tauri-apps/plugin-store' const store = await Store.load('settings.json') await store.set('some-key', { value: 5 }) const val = await store.get<{ value: number }>('some-key') if (val) { console.log(val) } else { console.log('val is null') } ``` -------------------------------- ### Install Tauri NFC Plugin (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/README.md Install the core NFC plugin for Tauri applications by adding the `tauri-plugin-nfc` dependency to your `Cargo.toml` file. You can use the crates.io version or specify a Git repository. ```toml [dependencies] tauri-plugin-nfc = "2.0.0" # alternatively with Git: tauri-plugin-nfc = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install Tauri Haptics Plugin (JavaScript Package Managers) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/README.md Installs the JavaScript Guest bindings for the Tauri Haptics plugin using common JavaScript package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-haptics # or npm add @tauri-apps/plugin-haptics # or yarn add @tauri-apps/plugin-haptics ``` -------------------------------- ### Install Tauri Plugin Process (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/process/README.md Add the Tauri plugin-process to your Rust project's Cargo.toml file. This can be done by referencing the crates.io version or directly from a Git repository. ```toml [dependencies] tauri-plugin-process = "2.0.0" # alternatively with Git: tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -------------------------------- ### Install JavaScript Guest Bindings Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/deep-link/README.md Installs the JavaScript guest bindings for the Tauri Deep Link plugin using common JavaScript package managers like pnpm, npm, or yarn. ```sh pnpm add @tauri-apps/plugin-deep-link # or npm add @tauri-apps/plugin-deep-link # or yarn add @tauri-apps/plugin-deep-link ``` -------------------------------- ### Install Tauri Plugin CLI (Rust) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/cli/README.md Adds the Tauri Plugin CLI to your Rust project's dependencies. Supports installation from crates.io or directly from GitHub. Requires Rust 1.77.2 or higher. ```toml # you can add the dependencies on the `[dependencies]` section if you do not target mobile [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] tauri-plugin-cli = "2.0.0" # alternatively with Git: tauri-plugin-cli = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ```