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 · Develop · all subjects

architecture & plugins

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

Migrate Updater plugin: Rust setup

Add `tauri-plugin-updater = "2"` to Cargo.toml. Initialize with `.plugin(tauri_plugin_updater::Builder::new().build())`. To set a custom update target: wrap the builder, e.g., `updater = updater.target("darwin-universal")` for macOS.

Migrate Updater plugin: Rust check for updates

Using `tauri-plugin-updater`, check for updates with the `UpdaterExt` trait: `let response = handle.updater().check().await;`

Migrate Updater plugin: JavaScript setup and check

Add `@tauri-apps/plugin-updater` and `@tauri-apps/plugin-process` to package.json. Initialize in Rust with `tauri_plugin_updater::Builder::new().build()`. Use JavaScript: `import { check } from '@tauri-apps/plugin-updater'` and `import { relaunch } from '@tauri-apps/plugin-process'`. Call `const update = await check()` and check `update?.available` to download and install.

Updater plugin migration example

To migrate from `@tauri-apps/api/updater`, add `tauri-plugin-updater = "2"` to Cargo.toml, initialize with `tauri::Builder::default().plugin(tauri_plugin_updater::Builder::new().build())`, and in JavaScript use `import { check } from '@tauri-apps/plugin-updater'; const update = await check(); if (update.response.available) { await update.downloadAndInstall(); }`

Updater plugin target configuration

To set a custom update target in the updater plugin, use `tauri_plugin_updater::Builder::new().target("darwin-universal")` for macOS before calling `.build()`.

Tauri v2: Rust manager API removals and moves

Several Rust manager APIs have been removed or moved: App::clipboard_manager and AppHandle::clipboard_manager removed (use tauri-plugin-clipboard); App::get_cli_matches removed (use tauri-plugin-cli); App::global_shortcut_manager and AppHandle::global_shortcut_manager removed (use tauri-plugin-global-shortcut); Manager::fs_scope removed (access via tauri_plugin_fs::FsExt); api::process::current_binary and api::process::restart moved to tauri::process.

Tauri v2: JavaScript plugin APIs moved

All non-core JavaScript modules moved to plugins: @tauri-apps/api/cli (use @tauri-apps/plugin-cli); @tauri-apps/api/clipboard (use @tauri-apps/plugin-clipboard-manager); @tauri-apps/api/dialog (use @tauri-apps/plugin-dialog); @tauri-apps/api/fs (use @tauri-apps/plugin-fs); @tauri-apps/api/global-shortcut (use @tauri-apps/plugin-global-shortcut); @tauri-apps/api/http (use @tauri-apps/plugin-http); @tauri-apps/api/os (use @tauri-apps/plugin-os); @tauri-apps/api/notification (use @tauri-apps/plugin-notification); @tauri-apps/api/process (use @tauri-apps/plugin-process); @tauri-apps/api/shell (use @tauri-apps/plugin-shell); @tauri-apps/api/updater (use @tauri-apps/plugin-updater).

Tauri v2: Plugin API changes

Plugin::PluginApi now receives plugin configuration as second argument. Plugin::setup_with_config has been removed in favor of latest tauri::Plugin::PluginApi.

Tauri v2: version API removal

The api::version module has been removed. Use the semver crate instead for version handling.

Tauri v2: CLI plugin migration example

To migrate CLI functionality in Tauri v2, add tauri-plugin-cli version 2 to Cargo.toml dependencies, initialize with tauri::Builder::default().plugin(tauri_plugin_cli::init()), add @tauri-apps/plugin-cli to package.json, and use getMatches() in JavaScript or app.cli().matches() in Rust.

Tauri v2: Clipboard plugin migration example

To migrate Clipboard functionality, add tauri-plugin-clipboard-manager version 2 to Cargo.toml, initialize with tauri::Builder::default().plugin(tauri_plugin_clipboard_manager::init()), add @tauri-apps/plugin-clipboard-manager to package.json, use writeText() and readText() in JavaScript, or use app.clipboard().write() in Rust with ClipboardExt and ClipKind traits.

Tauri v2: Dialog plugin migration example

To migrate Dialog functionality, add tauri-plugin-dialog version 2 to Cargo.toml, initialize with tauri::Builder::default().plugin(tauri_plugin_dialog::init()), add @tauri-apps/plugin-dialog to package.json, use save() or other dialog functions in JavaScript, or use app.dialog() methods in Rust with DialogExt trait.

Tauri v2: File System plugin JavaScript API changes

File System plugin API changes: Dir enum removed, use BaseDirectory instead; FileEntry, FsBinaryFileOption, FsDirOptions, FsOptions, FsTextFileOption, BinaryFileContents interfaces removed; createDir renamed to mkdir; readBinaryFile renamed to readFile; removeDir removed, replaced by remove; removeFile removed, replaced by remove; renameFile removed, replaced by rename; writeBinaryFile renamed to writeFile.

Tauri v2: Updater plugin migration example

To migrate Updater functionality, add tauri-plugin-updater version 2 to Cargo.toml, initialize with tauri::Builder::default().plugin(tauri_plugin_updater::Builder::new().build()), add @tauri-apps/plugin-updater to package.json. Use check() and downloadAndInstall() in JavaScript, or handle.updater().check() in Rust. Custom targets set via Builder in Rust.

Tauri v2: Path manager API usage

Path functionality moved to Manager::path. Usage: app.path().home_dir() returns home directory; app.path().resolve("path/to/something", BaseDirectory::Config) resolves path with base directory.

Tauri v2: Global Shortcut plugin configuration

Global Shortcut plugin added to Cargo with conditional dependency: [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] tauri-plugin-global-shortcut = "2". Initialize with tauri::Builder::default().plugin(tauri_plugin_global_shortcut::Builder::default().build())

Tauri v2: OS plugin usage example

OS plugin provides platform information. In JavaScript: import { arch } from '@tauri-apps/plugin-os'; const architecture = await arch();. In Rust: let os_arch = tauri_plugin_os::arch();

Tauri v2: Process plugin usage example

Process plugin for process management. In JavaScript: import { exit, relaunch } from '@tauri-apps/plugin-process'; await exit(0); await relaunch();. In Rust: app.handle().exit(1); or app.handle().restart();

Tauri v2: Notification plugin with permission check

Notification plugin requires permission check. In Rust: if app.notification().permission_state()? == PermissionState::Unknown { app.notification().request_permission()?; } if app.notification().permission_state()? == PermissionState::Granted { app.notification().builder().body("Message").show()?; }

Tauri v2: HTTP plugin with reqwest re-export

HTTP plugin re-exports reqwest. In Rust: use tauri_plugin_http::reqwest; let response = reqwest::get("url").await?; response.text().await

tauri-egui connects to Tauri runtime event loop

tauri-egui is a Tauri plugin that connects with the Tauri runtime event loop to allow creating glutin windows and using egui.

Create egui app by implementing eframe::App trait

To use egui in tauri-egui, implement the tauri_egui::eframe::App trait. The update method is called each time the UI needs repainting and receives an egui::Context and eframe::Frame.

Load PNG texture in egui with ctx.load_texture

Load a PNG image and allocate it as an egui texture using ctx.load_texture() with a texture name, ColorImage created from rgba data, and TextureFilter. Textures should be loaded once and cached in the app struct.

egui ComboBox for selection

Use egui::ComboBox to create a selection dropdown. Set the selected_text, call show_ui with a closure, and iterate over selectable_value options to populate the dropdown.

egui TextEdit password field

Create a password input field using ui.add_sized with egui::TextEdit::singleline(password).password(true) to hide the entered text.

egui button with conditional enable

Create a button using egui::Button::new() and pass it to ui.add_enabled(condition, button) to conditionally enable or disable the button based on a boolean condition.

egui text field focus and Enter key handling

Detect when a text field loses focus with textfield.lost_focus() and when Enter is pressed with ui.input().key_pressed(egui::Key::Enter). Use textfield.request_focus() to regain focus.

egui CentralPanel for layout

Use egui::CentralPanel::default().show(ctx, closure) to create a panel that covers the remainder of the screen for your UI layout.

egui Layout top_down and Align for positioning

Use egui::Layout::top_down(egui::Align::Center) or egui::Layout::top_down(egui::Align::Min) to specify vertical layouts with top-down alignment and horizontal centering or left alignment.

egui example login layout

A complete example showing how to build a login layout in tauri-egui including a logo and heading, user selection ComboBox, password TextEdit field, submit button, and password validation with communication via mpsc channel.

Customize egui style with Context#set_style

Customize the look and feel of an egui application using the Context#set_style API available in the egui crate.

Verso is a browser based on Servo with ergonomic Tauri integration

Verso is a browser built on top of Servo, a web browser rendering engine written in Rust. It provides a simpler, more ergonomic API than Servo directly, making it easier to embed and use compared to Servo's low-level APIs. Verso is designed to be easier for people to experiment with and integrate into applications like Tauri.

Why Verso over Servo directly

Servo's APIs are low-level and daunting to use despite being relatively easy to embed compared to other browsers. Verso was created to provide a simpler, more ergonomic API that makes it easy enough for people to experiment with and actually use Servo, with APIs tailored for embedding use cases rather than supporting Servo's broader feature set.

Give your agent this brain