new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Tauri · Develop · all subjects

windows & ui

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

Create multiple windows in tauri.conf.json

Windows can be created in the Tauri configuration file (tauri.conf.json) under the app.windows array. Each window object requires: label (unique identifier), title (display name), width (in pixels), and height (in pixels).

Create multiple windows programmatically in Rust

Windows can be created programmatically in the Rust setup handler using tauri::WebviewWindowBuilder::new(app, label, webview_url) which returns a window that must be built with .build()?. Multiple windows can be created by calling this builder multiple times with different labels and URLs.

Removed Rust Menu APIs in Tauri v2

Tauri v2 removes: Menu, MenuEvent, CustomMenuItem, Submenu, WindowMenuEvent, MenuItem, and Builder::on_menu_event.

Removed Rust SystemTray APIs in Tauri v2

Tauri v2 removes: SystemTray, SystemTrayHandle, SystemTrayMenu, SystemTrayMenuItemHandle, SystemTraySubmenu, MenuEntry, and SystemTrayMenuItem APIs.

JavaScript window module rename

Rename @tauri-apps/api/window to @tauri-apps/api/webviewWindow. WebviewWindow class is exported from @tauri-apps/api/webviewWindow.

Multiwebview support in Tauri v2

Tauri v2 introduces support for multiwebview under unstable feature flag. Rust Window type renamed to WebviewWindow. Manager get_window renamed to get_webview_window.

Windows frontend origin URL change

In Tauri v2, frontend files on Windows are hosted at http://tauri.localhost instead of https://tauri.localhost. This resets IndexedDB, LocalStorage, and Cookies from v1 unless dangerousUseHttpScheme was used. To preserve, set app > windows > useHttpsScheme to true or use WebviewWindowBuilder::use_https_scheme.

Menu module migration to MenuBuilder

In Tauri v2 Rust, replace tauri::Menu with tauri::menu::MenuBuilder. MenuBuilder constructor takes Manager instance (App, AppHandle, or WebviewWindow). Example: let menu = MenuBuilder::new(app).copy().paste().build()?;

PredefinedMenuItem usage in Tauri v2

In Tauri v2 Rust menus, replace tauri::MenuItem with tauri::menu::PredefinedMenuItem. Example: MenuBuilder::new(app).item(&PredefinedMenuItem::copy(app)?).build()?; Or use shorthand: MenuBuilder::new(app).copy().build()?;

MenuItemBuilder usage in Tauri v2

In Tauri v2 Rust, replace tauri::CustomMenuItem with tauri::menu::MenuItemBuilder. Example: let toggle = MenuItemBuilder::new("Toggle").accelerator("Ctrl+Shift+T").build(app)?;

SubmenuBuilder usage in Tauri v2

In Tauri v2 Rust, replace tauri::Submenu with tauri::menu::SubmenuBuilder. Example: let submenu = SubmenuBuilder::new(app, "Sub").text("Tauri").separator().check("Is Awesome").build()?;

Menu events migration in Tauri v2

In Tauri v2 Rust, replace tauri::Builder::on_menu_event with tauri::App::on_menu_event or tauri::AppHandle::on_menu_event. Menu items should have IDs to compare in handlers. Example: if event.id() == check.id() { /* handle */ }

TrayIconBuilder usage in Tauri v2

In Tauri v2 Rust, replace tauri::SystemTray with tauri::tray::TrayIconBuilder. Example: let tray = tauri::tray::TrayIconBuilder::with_id("my-tray").build(app)?;

Tray menu APIs in Tauri v2

In Tauri v2 Rust tray: replace SystemTrayMenu with tauri::menu::Menu, SystemTraySubmenu with tauri::menu::Submenu, SystemTrayMenuItem with tauri::menu::PredefinedMenuItem.

Tray events migration in Tauri v2

In Tauri v2 Rust, SystemTray::on_event splits into TrayIconBuilder::on_menu_event and TrayIconBuilder::on_tray_icon_event. Example checks TrayIconEvent::Click with MouseButton::Left and MouseButtonState::Up.

Window API rename to WebviewWindow in Tauri v2

In Tauri v2 Rust, Window renamed to WebviewWindow, WindowBuilder to WebviewWindowBuilder, WindowUrl to WebviewUrl. Manager::get_window renamed to get_webview_window. Window parent_window API renamed to parent_raw.

Give your agent this brain