Crate tauri_runtime_verso

Source
Expand description

§Tauri Runtime Verso

Use Verso as the backend for Tauri

§Usage

To get started, you need to add this crate to your project, and use default-feature = false on tauri to disable the wry feature

  [build-dependencies]
  tauri-build = "2"
+ tauri-runtime-verso-build = { git = "https://github.com/versotile-org/tauri-runtime-verso.git" }

  [dependencies]
- tauri = { version = "2", features = [] }
+ tauri = { version = "2", default-features = false, features = ["common-controls-v6", "x11"] }
+ tauri-runtime-verso = { git = "https://github.com/versotile-org/tauri-runtime-verso.git" }

In your build script, add the tauri-runtime-verso-build script, which will download the pre-built versoview to versoview/versoview-{target-triple}

Note we currently only have pre-built versoview for x64 Linux, Windows, MacOS and arm64 MacOS, also the download might take a bit of time if you have a slow internet connection

fn main() {
+   tauri_runtime_verso_build::get_verso_as_external_bin().unwrap();
    tauri_build::build();
}

Then add the downloaded executable to your tauri config file (tauri.conf.json) as an external binary file

  {
+   "bundle": {
+     "externalBin": [
+       "versoview/versoview"
+     ]
+   }
  }

Finally, setup the code like this:

fn main() {
-   tauri::Builder::new()
+   tauri_runtime_verso::builder()
        .run(tauri::generate_context!())
        .unwrap();
}

§Tips

§Devtools

Since Verso doesn’t have a devtools built-in, you’ll need to use the one from the Firefox, first put in this in your code

// This will make the webviews created afters this open up a devtools server on this port,
// setting it to 0 for a random port
tauri_runtime_verso::set_verso_devtools_port(1234);

Then go to about:debugging in Firefox and connect to localhost:1234 there

§Cargo features

  • macos-private-api: Matching with Tauri’s macos-private-api feature, required if you use that

Structs§

EventProxy
RuntimeContext
VersoRuntime
A Tauri Runtime wrapper around Verso.
VersoRuntimeHandle
A handle to the VersoRuntime runtime.
VersoWebviewDispatcher
The Tauri [WebviewDispatch] for VersoRuntime.
VersoWindowBuilder
VersoWindowDispatcher
The Tauri [WindowDispatch] for VersoRuntime.

Constants§

INVOKE_SYSTEM_SCRIPTS
You need to set this on [tauri::Builder::invoke_system] for the invoke system to work, you can skip this if you’re using tauri_runtime_verso::builder

Functions§

builder
Creates a new [tauri::Builder] using the VersoRuntime
set_verso_devtools_port
Sets the Verso devtools port to ues for the webviews, 0 for random port, note this only affects webviews created after you set this
set_verso_path
Sets the Verso executable path to ues for the webviews, must be called before you create any webviews if you don’t have the externalBin setup
set_verso_resource_directory
Sets the Verso resources directory to ues for the webviews, note this only affects webviews created after you set this