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

webview & rendering

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

Window API: JavaScript export location

JavaScript 'WebviewWindow' class is now exported from '@tauri-apps/api/webviewWindow' (not '@tauri-apps/api/window').

JavaScript window menu: onMenuClicked removed

JavaScript 'onMenuClicked' function was removed. Use JavaScript to create menus and handle menu events instead.

Windows frontend URL scheme change in Tauri 2.0

In Tauri 2.0, Windows production apps host frontend files at 'http://tauri.localhost' instead of 'https://tauri.localhost'. This resets IndexedDB, LocalStorage, and Cookies unless v1 used dangerousUseHttpScheme. To preserve, set 'app > windows > useHttpsScheme' to true or use WebviewWindowBuilder::use_https_scheme().

Linux graphics common symptoms

Common symptoms of graphics issues on Linux include: the window opens but stays blank or white; the window flickers, especially while resizing; the app dies on resize with no useful error output; console shows 'AcceleratedSurfaceDMABuf was unable to construct a complete framebuffer'; console shows 'Gdk-Message: Error 71 (Protocol error) dispatching to Wayland display.'

Linux graphics workaround: kernel mode setting

Make sure kernel mode setting is on. NVIDIA drivers older than 545 often need 'nvidia_drm.modeset=1' as a kernel parameter. This is the first workaround to try as it keeps hardware acceleration.

Linux graphics workaround: __NV_DISABLE_EXPLICIT_SYNC

Set the environment variable __NV_DISABLE_EXPLICIT_SYNC=1. This often fixes the Wayland 'Error 71' crash without a performance cost. This is the second workaround to try.

Linux graphics workaround: WEBKIT_DISABLE_DMABUF_RENDERER

Set the environment variable WEBKIT_DISABLE_DMABUF_RENDERER=1. This fixes the DMABUF framebuffer error and the 'Error 71' crash, at the cost of the faster rendering path. This is the third workaround to try.

Linux graphics workaround: WEBKIT_DISABLE_COMPOSITING_MODE

Set the environment variable WEBKIT_DISABLE_COMPOSITING_MODE=1. This is the last resort for the silent crash on resize. This disables accelerated compositing entirely.

Setting Linux graphics workarounds in Rust code

Graphics workarounds can be set in main() before the webview is created so users do not have to set environment variables. Example: #[cfg(target_os = "linux")] std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");

Linux graphics workaround deployment guidance

Only ship an unconditional override like setting WEBKIT_DISABLE_DMABUF_RENDERER if you have verified your app is affected. It disables a faster path for everyone, including users on working setups.

WebGL fallback strategy for Linux

If your app has a WebGL rendering path and experiences high input latency or low frame rates in WebGL heavy views on Linux (terminal emulators, editors, maps, charts), provide a non-WebGL fallback and consider exposing a setting so users can switch, instead of trusting the context to tell you what renderer is available.

WebGL and canvas silent failures on Linux

WebGL and canvas content can silently land on a slow path while the rest of the app looks fine. WebGL2 context creation succeeds even when the result is backed by a software rasterizer or a slow presentation path, with no error to catch. WebKitGTK masks the WebGL renderer string for fingerprinting protection, reporting 'Apple GPU' on every Linux machine.

Linux graphics rendering backend

On Linux, Tauri renders through WebKitGTK.

NVIDIA GPU DMABUF renderer issues on Linux

On NVIDIA GPUs, WebKitGTK and the graphics driver can disagree, causing blank windows, subtle rendering problems, flickering, and crashes on resize. Most issues come from the WebKitGTK DMABUF renderer requesting buffer formats the NVIDIA driver does not provide.

WebView process function

The Core process spins up WebView processes that leverage WebView libraries provided by the operating system. A WebView is a browser-like environment that executes HTML, CSS, and JavaScript. WebView libraries are not included in the final executable but are dynamically linked at runtime.

Dynamic WebView linking makes applications smaller

WebView libraries are dynamically linked at runtime rather than included in the final executable, making Tauri applications significantly smaller. However, platform differences must be kept in mind, similar to traditional web development.

Platform-specific WebView implementations

Tauri currently uses Microsoft Edge WebView2 on Windows, WKWebView on macOS, and webkitgtk on Linux.

WebView process runs HTML, CSS, and JavaScript

WebView processes use WebView libraries provided by the operating system to run HTML, CSS, and JavaScript in a browser-like environment. The core process does not directly render the user interface; instead, it manages WebView processes.

WebView libraries are dynamically linked at runtime

WebView libraries are not included in the final executable but are dynamically linked at runtime. This makes applications significantly smaller but requires awareness of platform differences during development.

raw_window_handle::HasRawDisplayHandle implementation

Tauri 1.1.0 implements raw_window_handle::HasRawDisplayHandle for both App and AppHandle.

Windows dialog style enhancement

Tauri 1.1.0 enhances dialog style on Windows via the manifest dependency Microsoft.Windows.Common-Controls v6.0.0.0.

Theme APIs on Linux

Tauri 1.1.0 adds theme APIs on Linux.

Linux custom protocol headers support in Tauri 1.2.0

The Linux webview binding in Tauri 1.2.0 added support for custom protocol headers when running on webkit2gtk version 2.36 or above. This fixed CORS issues in production when manually fetching a build asset.

Windows webview theme synchronization with window theme

On Windows, Tauri 1.3 changes the webview theme based on window theme for more accurate prefers-color-scheme support.

Window control disabling in Tauri 1.4.0

The window's maximize, minimize and close buttons can be disabled via configuration or API calls. The Rust APIs are set_maximizable, set_minimizable, and set_closable. The JavaScript APIs are setMaximizable, setMinimizable, and setClosable.

WebKit2GTK-4.0 vs 4.1 soup library difference

The main difference between WebKit2GTK-4.0 and WebKit2GTK-4.1 is the soup library version. WebKit2GTK-4.0 uses soup2 while WebKit2GTK-4.1 uses soup3. Applications that do not use soup2-specific APIs should continue to work without modification.

WebKit2GTK version upgrade to 4.1 in Tauri 2.0

Tauri v2.0.0-alpha.3 and later versions use WebKit2GTK-4.1 as the backend for the Linux port. This is a departure from the 1.x versions and earlier 2.0 alpha versions which used WebKit2GTK-4.0.

v2 supports multiple webviews in a single window

Tauri v2 now supports adding multiple webviews to a single window. This feature is hidden behind an unstable Cargo feature flag while the API design is reviewed with the community.

New window effects and shadow options in Tauri 2.0

Tauri 2.0 added `shadow` option when creating a webview window, with `WebviewWindow::set_shadow` method in Rust and equivalent API in JavaScript. The `windowEffects` option was added when creating a webview window, with `WebviewWindow::set_effects` available to change effects at runtime.

Drag and drop events in Tauri 2.0

Tauri 2.0 renamed file drop events and types: `tauri::FileDropEvent` enum was renamed to `tauri::DragDropEvent` with renamed variants; `tauri::WindowEvent::FileDrop` was renamed to `tauri::WindowEvent::DragDrop`; file drop emitted events were renamed to `tauri://drag-enter`, `tauri://drag-over`, `tauri://drag-drop`, and `tauri://drag-leave`; `tauri::WebviewWindow::disable_file_drop_handler` was renamed to `tauri::WebviewWindow::disable_drag_drop_handler`; drag and drop events now include drop and hover position information.

Monitor and cursor APIs in Tauri 2.0

Tauri 2.0 added `tauri::App/AppHandle::primary_monitor` and `App/AppHandle::available_monitors` methods to access monitor information. It also added `tauri::App/AppHandle/WebviewWindow::cursor_position` getter to get the current cursor position and `tauri::App/AppHandle/WebviewWindow::monitor_from_point(x,y)` getter to get the monitor from a given point.

WebviewWindow navigate method in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::navigate` method to navigate to a new URL.

Incognito mode and visibility options in Tauri 2.0

Tauri 2.0 added `incognito` option when creating a webview window and `visibleOnAllWorkspaces` option when creating a webview window.

Window icon API in Tauri 2.0

Tauri 2.0 added `tauri::App/AppHandle::default_window_icon` method and `defaultWindowIcon` to the JS `app` module to retrieve the default window icon in JavaScript. The `tauri::Image` type replaced the removed `tauri::Icon` enum.

Download event handling in Tauri 2.0

Tauri 2.0 added `tauri::WindowBuilder::on_download` to handle download request events.

Window resizing and dragging in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::start_resize_dragging` and `tauri::ResizeDirection` enum. On Windows, resizing of undecorated windows is now handled natively, improving performance and fixing cursor flickering when moving across edges, allowing resize from top even with `data-tauri-drag-region` elements there, and preventing accidental clicks behind when starting a resize.

Window sizing constraints in Tauri 2.0

Tauri 2.0 added APIs to enable setting window size constraints separately: `tauri::WindowBuilder::inner_size_constraints`, `tauri::WebviewWindowBuilder::inner_size_constraints`, `tauri::WindowSizeConstraints` struct, `tauri::Window::set_size_constraints`, and `tauri::WebviewWindow::set_size_constraints`. The bug where `minWidth`, `minHeight`, `maxWidth`, and `maxHeight` constraints were never applied unless width and height were constrained together was fixed.

Window title bar styling on macOS in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::set_title_bar_style` to set title bar at runtime on macOS.

Always on bottom window option in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::set_always_on_bottom` method and `alwaysOnTop` option when creating a webview window.

Window zoom API in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::set_zoom` method and `zoomHotkeys` option when creating a webview window.

Window progress bar in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::set_progress_bar` method.

Window destruction in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindow::destroy` to force close a window. The behavior of `tauri::WebviewWindow::close` changed to trigger a close requested event instead of forcing the window to be closed.

Proxy URL for webview in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindowBuilder::proxy_url` method.

Page load event handling in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindowBuilder::on_page_load` method. The `tauri::Builder::on_page_load` handler now takes references and is triggered for both load started and finished events; see `tauri::PageLoadPayload::event` field to determine what triggered it.

Webview events in Tauri 2.0

Tauri 2.0 added `tauri::WebviewEvent` enum, `tauri::RunEvent::WebviewEvent` variant, `tauri::Builder::on_webview_event` and `tauri::Webview::on_webview_event` methods.

Image handling in Tauri 2.0

Tauri 2.0 added `tauri::image` module which includes `tauri::image::Image` and `tauri::image::JsImage` types and `tauri::image::include_img!` macro. The `tauri::Icon` enum was removed; use the new `tauri::Image` type instead.

Window parent and owner in Tauri 2.0

Tauri 2.0 added `tauri::WebviewWindowBuilder::parent` which is a convenient wrapper around parent functionality for Windows, Linux, and macOS. Added `tauri::WebviewWindowBuilder::owner` on Windows only. Added `tauri::WebviewWindowBuilder::transient_for` and `tauri::WebviewWindowBuilder::transient_for_raw` on Linux only. Renamed `tauri::WebviewWindowBuilder::owner_window` to `tauri::WebviewWindowBuilder::owner_raw` and `tauri::WebviewWindowBuilder::parent_window` to `tauri::WebviewWindowBuilder::parent_raw`.

Webview URL getter change in Tauri 2.0

Tauri 2.0 changed `tauri::WebviewWindow::url` getter to return a result.

Centering newly created window improvement in Tauri 2.0

Tauri 2.0 enhanced centering a newly created window so it will no longer jump to center after being visible.

JS path APIs improvement in Tauri 2.0

Tauri 2.0 improved the JS `path` APIs to return simplified paths on Windows when possible, removing UNC (`\\?\`) prefix.

Set activation policy fix on Windows in Tauri 2.0

Tauri 2.0 fixed calling `set_activation_policy` when the event loop is running.

Close window prevention from another webview fix in Tauri 2.0

Tauri 2.0 fixed preventing closing a window from another webview.

JS basename API fix in Tauri 2.0

Tauri 2.0 fixed the JS `basename(path, 'ext')` API implementation which was removing all occurrences of `ext` instead of only removing the last one.

Rect struct added in Tauri 2.0

Tauri 2.0 added `tauri::Rect` struct.

window.isTauri JavaScript global function

Tauri 2.0 added `window.isTauri` JS global function to check whether running in Tauri or not.

Give your agent this brain