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

configuration & setup

83 notes in this subject, read out of this brain and free to use. This is page 1 of 2.

Binary name configuration in Tauri 2

In Tauri 2, add mainBinaryName at the top level of tauri.config.json to match productName, since the binary is no longer automatically renamed to match productName like in Tauri 1.

Tauri migrate command automates migration

Tauri 2 CLI includes a migrate command that automates most of the v1 to v2 migration process. Run with npm run tauri migrate, yarn tauri migrate, pnpm tauri migrate, or cargo tauri migrate.

Global Tauri API configuration moved

In Tauri 2, build.withGlobalTauri moved to app.withGlobalTauri.

Development server URL configuration renamed

In Tauri 2, build.devPath was renamed to devUrl.

Frontend distribution directory configuration renamed

In Tauri 2, build.distDir was renamed to frontendDist.

Updater configuration in Tauri 2

In Tauri 2, tauri.updater.active and tauri.updater.dialog were removed. The updater moved to plugins.updater. Additionally, bundle.createUpdaterArtifacts must be configured when using the updater. Set it to v1Compatible when migrating from Tauri v1 applications that were already distributed.

Window drag and drop configuration renamed

In Tauri 2, tauri.windows.fileDropEnabled was renamed to app.windows.dragDropEnabled.

Asset protocol scope configuration moved

In Tauri 2, tauri.allowlist.protocol.assetScope moved to app.security.assetProtocol.scope.

Tauri 2 configuration structure changes from Tauri 1

In Tauri 2, the configuration root changed significantly: package.productName and package.version moved to top level; package field was removed; tauri key renamed to app; allowlist removed (use capabilities instead); tauri.cli moved to plugins.cli; tauri.updater moved to plugins.updater; tauri.systemTray renamed to app.trayIcon; tauri.pattern moved to app.security.pattern; tauri.bundle moved to top level.

Tauri configuration changes from v1 to v2

Configuration changes in Tauri v2: `tauri > allowlist` removed entirely. `tauri > allowlist > protocol > assetScope` moved to `tauri > security > assetProtocol > scope`. `tauri > cli` moved to `plugins > cli`. `tauri > updater` moved to `tauri > bundle > updater`. `tauri > updater > dialog` removed. `tauri > updater > endpoints` moved to `plugins > updater`. `tauri > systemTray` renamed to `tauri > trayIcon`. Reference: Tauri 2.0 configuration API.

Cargo feature changes from Tauri 1 to v2

New Cargo features in v2: `linux-protocol-body` enables protocol request body parsing for IPC, requires webkit2gtk 2.40. Removed Cargo features: `reqwest-client` (reqwest is now the only supported client), `reqwest-native-tls-vendored` (use `native-tls-vendored` instead), `process-command-api` (use shell plugin), `shell-open-api` (use shell plugin), `windows7-compat` (moved to notification plugin), `updater` (now a plugin), `linux-protocol-headers` (now enabled by default), `system-tray` (renamed to `tray-icon`).

Using --alpha flag with create-tauri-app

The --alpha flag can be passed to create-tauri-app to bootstrap an app that uses tauri@2.0.0-beta. When adding the --alpha flag, it will automatically prompt if you want to add mobile support. The --mobile flag can also be used to automatically make the project mobile compatible.

create-tauri-app commands for Tauri 2.0 alpha

Commands to create a new Tauri app with alpha version support: pnpm create tauri-app --alpha; yarn create tauri-app --alpha; npm create tauri-app -- --alpha; cargo install create-tauri-app --locked && cargo create-tauri-app --alpha; sh <(curl https://create.tauri.app/sh) --alpha; $env:CTA_ARGS="--alpha";iwr -useb https://create.tauri.app/ps | iex

create-tauri-app frontend language selection

create-tauri-app version 3 asks users to choose their frontend language first, with options including Rust and TypeScript/JavaScript. After choosing the frontend language, users are prompted for package manager selection if the language has multiple options.

UI templates retained in create-tauri-app version 3

create-tauri-app version 3 retained the most popular frontend frameworks: Vanilla, Vue, Svelte, React, Solid, Angular, and Next.js. Removed templates were: Next, Next-ts, Preact, Preact-ts, ClojureScript, SvelteKit, and SvelteKit-ts.

create-tauri-app two-step template selection

create-tauri-app version 3 split template selection into two prompts: first selecting the UI template (Vanilla, Vue, Svelte, React, Solid, Angular, Next, SvelteKit, ClojureScript, Preact), then selecting any template-specific options such as TypeScript or JavaScript flavor.

create-tauri-app version 3 released with Tauri 2.0 alpha support

create-tauri-app version 3 added support for Tauri 2.0 alpha version, mobile project initialization for iOS and Android, and removed less commonly used templates. The version was released on 2023-03-01.

Using previous versions of create-tauri-app

Previous versions of create-tauri-app can still be accessed: pnpm create tauri-app@2; yarn create tauri-app@2; npm create tauri-app@2; cargo install create-tauri-app --version 2.8.0 --locked; sh <(curl https://create.tauri.app/v/2.8.0/sh); iwr -useb https://create.tauri.app/v/2.8.0/ps | iex

Environment variable renames in Tauri 2.0

Environment variable name changes: TAURI_PRIVATE_KEY→TAURI_SIGNING_PRIVATE_KEY, TAURI_KEY_PASSWORD→TAURI_SIGNING_PRIVATE_KEY_PASSWORD, TAURI_SKIP_DEVSERVER_CHECK→TAURI_CLI_NO_DEV_SERVER_WAIT, TAURI_DEV_SERVER_PORT→TAURI_CLI_PORT, TAURI_PATH_DEPTH→TAURI_CLI_CONFIG_DEPTH, TAURI_FIPS_COMPLIANT→TAURI_BUNDLER_WIX_FIPS_COMPLIANT, TAURI_DEV_WATCHER_IGNORE_FILE→TAURI_CLI_WATCHER_IGNORE_FILENAME, TAURI_TRAY→TAURI_LINUX_AYATANA_APPINDICATOR, TAURI_APPLE_DEVELOPMENT_TEAM→APPLE_DEVELOPMENT_TEAM.

Embedded resources migration guidance

When migrating embedded resources: perform File System plugin migration for JavaScript; perform Path to Tauri Manager migration for Rust; review permission migration for both.

Configuration migration: CLI and updater plugins

Move 'tauri > cli' to 'plugins > cli'. Remove 'tauri > updater > active' and 'tauri > updater > dialog'. Move 'tauri > updater' to 'plugins > updater'. Add 'bundle > createUpdaterArtifacts' setting; set to 'v1compatible' when upgrading existing v1 apps.

Configuration migration: tray and patterns

Rename 'tauri > systemTray' to 'app > trayIcon'. Move 'tauri > pattern' to 'app > security > pattern'. Move 'tauri > bundle' to top-level. Move 'tauri > bundle > identifier' to top-level object.

Configuration migration: build paths

Move 'build > withGlobalTauri' to 'app > withGlobalTauri'. Rename 'build > distDir' to 'frontendDist'. Rename 'build > devPath' to 'devUrl'.

Configuration migration: window settings

Rename 'tauri > windows > fileDropEnabled' to 'app > windows > dragDropEnabled'.

Removed Env.args in Tauri 2.0

The 'Env.args' field was removed; use 'Env.args_os' field instead.

Environment variable renames for platform detection in Tauri 2.0

Platform detection environment variable renames: TAURI_PLATFORM→TAURI_ENV_PLATFORM, TAURI_ARCH→TAURI_ENV_ARCH, TAURI_FAMILY→TAURI_ENV_FAMILY, TAURI_PLATFORM_VERSION→TAURI_ENV_PLATFORM_VERSION, TAURI_PLATFORM_TYPE→TAURI_ENV_PLATFORM_TYPE, TAURI_DEBUG→TAURI_ENV_DEBUG.

Tauri v2 migrate CLI command

Tauri v2 CLI includes a 'migrate' command to automate most migration work from v1 to v2. Run: npm install @tauri-apps/cli@latest && npm run tauri migrate (or equivalent with yarn/pnpm/cargo).

Configuration file migration: top-level moves

In Tauri 2.0 configuration: move 'package > productName' and 'package > version' to top-level object; add 'mainBinaryName' string to top-level matching productName (no longer auto-matched); remove 'package' key; rename 'tauri' key to 'app'.

Configuration migration: allowlist and permissions

Remove 'tauri > allowlist' entirely; migrate permissions to the new capabilities-based system. Move 'tauri > allowlist > protocol > assetScope' to 'app > security > assetProtocol > scope'.

Multiple windows in tauri.conf.json configuration

Windows can be created in the Tauri configuration file (typically tauri.conf.json) by defining an array under the app.windows field. Each window object requires a label, title, width, and height property.

Programmatic window creation with WebviewWindowBuilder

Windows can be created programmatically in Rust using tauri::WebviewWindowBuilder::new(app, label, webview_url). The builder pattern allows setting title and building the window with .build()?.

Plugin initialization command

To bootstrap a new plugin project, run 'npx @tauri-apps/cli plugin new [name]'. Use the --no-api flag if no NPM package is needed, and --android and/or --ios flags to include mobile support. To add mobile capabilities to existing plugins, use 'plugin android add' or 'plugin ios add'.

Plugin configuration in tauri.conf.json

Plugin configuration is specified in tauri.conf.json under the 'plugins' object with the plugin name as key. Configuration is parsed at runtime and passed to the plugin via the Builder. Optional configuration can be handled by using 'Builder::<R, Option<Config>>' instead of 'Builder::<R, Config>'.

Plugin configuration loading on Android

On Android, define a configuration class annotated with @app.tauri.annotation.InvokeArg. In the plugin's load method, call getConfig(Config::class.java) which returns the parsed configuration object.

Plugin configuration loading on iOS

On iOS, define a configuration struct that inherits Decodable. In the plugin's load method, call parseConfig(Config.self) which returns the parsed configuration object, wrapped in a do-catch block.

Platform-specific configuration merge example

When a base tauri.conf.json and platform-specific tauri.linux.conf.json are merged, the platform-specific values override the base configuration. For example, if the base has `productName: MyApp` and Linux config has `productName: my-app`, the resolved Linux configuration will use `my-app`. Array values like `bundle.resources` in the platform-specific config completely replace the base array rather than merging.

Tauri configuration supported formats

The default Tauri config format is JSON. JSON5 format can be enabled by adding the `config-json5` feature flag to both `tauri-build` and `tauri` dependencies in Cargo.toml. TOML format can be enabled by adding the `config-toml` feature flag to both `tauri-build` and `tauri` dependencies. JSON5 and TOML support comments, and TOML can use kebab-case for config names. Field names are case-sensitive in all three formats.

Platform-specific configuration file naming

Platform-specific configuration files are merged with the main configuration following JSON Merge Patch (RFC 7396) specification. Linux uses `tauri.linux.conf.json` or `Tauri.linux.toml`. Windows uses `tauri.windows.conf.json` or `Tauri.windows.toml`. macOS uses `tauri.macos.conf.json` or `Tauri.macos.toml`. Android uses `tauri.android.conf.json` or `Tauri.android.toml`. iOS uses `tauri.ios.conf.json` or `Tauri.ios.toml`.

Tauri CLI --config extension argument

The Tauri CLI allows extending the Tauri configuration when running `dev`, `android dev`, `ios dev`, `build`, `android build`, `ios build` or `bundle` commands. The `--config` argument accepts either a raw JSON string or a path to a JSON file. Tauri uses JSON Merge Patch (RFC 7396) to merge the provided configuration with the originally resolved configuration object. This enables defining multiple flavours of an application or having flexibility when configuring bundles.

Tauri configuration file purpose

The Tauri configuration defines the source of the Web app, describes application metadata, configures bundles, sets plugin configurations, and modifies runtime behavior by configuring windows, tray icons, and menus. It is used by both the Tauri runtime and the Tauri CLI. The configuration file can define build settings such as command to run before `tauri build` or `tauri dev`, set the product name and version of the app, control the Tauri runtime, and configure plugins.

Cargo.toml tauri and tauri-build version requirement

The `tauri-build` and `tauri` dependencies in Cargo.toml must generally both be on the same latest minor versions as the Tauri CLI, though this is not strictly required. Cargo uses Semantic Versioning, so specifying `2.0.0` will pull the latest Semver-compatible version available (e.g., `2.0.1`). For exact versions, prepend `=` to the version number. Running `cargo update` in the `src-tauri` folder will pull the latest available Semver-compatible versions of all dependencies.

Cargo.toml features flag auto-management

Running `tauri dev` and `tauri build` automatically manages which features need to be enabled in the `tauri` dependency based on the Tauri configuration. The `features=[]` portion of the `tauri` dependency does not need manual management for basic functionality.

Cargo.lock file commit recommendation

When building a Tauri application, a `Cargo.lock` file is produced. This file ensures that the same dependencies are used across machines during development, similar to `yarn.lock`, `pnpm-lock.yaml` or `package-lock.json` in Node.js. It is recommended to commit this file to the source repository to ensure consistent builds.

package.json scripts for Tauri development

In package.json, the `scripts` section typically includes a `dev` command to start the frontend framework and a `build` command to build frontend Web assets. These scripts can be hooked with the Tauri CLI via the Tauri configuration's `beforeDevCommand` and `beforeBuildCommand` hooks. The `tauri` script is only needed when using `npm`.

Tauri configuration example with JSON5 format

Example tauri.conf.json or tauri.conf.json5 configuration: `{ build: { devUrl: 'http://localhost:3000', beforeDevCommand: 'npm run dev' }, bundle: { active: true, icon: ['icons/app.png'] }, app: { windows: [{ title: 'MyApp' }] }, plugins: { updater: { pubkey: 'updater pub key', endpoints: ['https://my.app.updater/{{target}}/{{current_version}}'] } } }`

Tauri configuration example with TOML format

Example Tauri.toml configuration: `[build] dev-url = "http://localhost:3000" before-dev-command = "npm run dev" [bundle] active = true icon = ["icons/app.png"] [[app.windows]] title = "MyApp" [plugins.updater] pubkey = "updater pub key" endpoints = ["https://my.app.updater/{{target}}/{{current_version}}"]`

beforeDevCommand and beforeBuildCommand working directory configuration

In Tauri 1.1.0, beforeDevCommand and beforeBuildCommand now have an option to configure the current working directory where they execute.

JSON5 configuration format support

Tauri 1.0 supports JSON5 configuration format when the config-json5 Cargo feature is enabled, allowing comments and unquoted keys in the configuration file.

TOML configuration format support in Tauri.toml

Tauri 1.1.0 includes TOML configuration format support behind the config-toml Cargo feature. Configuration can now be defined in a Tauri.toml file using TOML syntax, for example: [build] dev-path = "http://localhost:8000" dist-dir = "../dist".

beforeDevCommand forced wait configuration

Tauri 1.1.0 allows configuring beforeDevCommand to force the CLI to wait for the command to finish before proceeding.

.taurignore file support

Tauri 1.1.0 automatically uses any .taurignore file as ignore rules for the dev watcher and app path finder.

tabbingIdentifier window option for macOS in Tauri 1.2.0

Tauri 1.2.0 added the tabbingIdentifier window option for macOS.

app-specific directory APIs enhancement in Tauri 1.2.0

Tauri 1.2.0 enhanced the app-specific directory APIs.

MacOS tray set_title method in Tauri 1.2.0

Tauri 1.2.0 exposed the set_title method for macOS system tray.

macOS titlebar configuration options in Tauri 1.2.0

Tauri 1.2.0 introduced titlebar style configuration for macOS applications. Options include defining a transparent or overlay titlebar, hiding the window title text, and defining the window to accept first mouse events so it can be focused immediately after receiving a click event to be dragged.

User agent configuration for windows in Tauri 1.2.0

Tauri 1.2.0 allows configuring the user agent when creating a window.

acceptFirstMouse window option for macOS in Tauri 1.2.0

Tauri 1.2.0 added the acceptFirstMouse window option for macOS.

Unfocused windows reimplemented in Tauri 1.2.0

Tauri 1.2.0 reimplemented the option to create unfocused windows.

Cargo workspace inheritance support in Tauri 1.3

Tauri 1.3 added support for Cargo's workspace inheritance.

CLI completions support in Tauri 1.4.0

The Tauri CLI can generate shell completions for Bash, Zsh, PowerShell, and Fish shells.

Give your agent this brain