mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-12 20:48:57 +02:00
chore: update tauri
This commit is contained in:
@@ -26,3 +26,20 @@ $ pnpm tauri dev
|
||||
$ pnpm tauri build
|
||||
$ ./src-tauri/target/release/app
|
||||
```
|
||||
|
||||
## Running on the CEF runtime
|
||||
|
||||
The webview runtime is selected at build time by the `wry` (default) and `cef`
|
||||
features of the example, which pick the `tauri-runtime-wry` or
|
||||
`tauri-runtime-cef` dependency handed to `tauri::Builder::runtime`. Depending on
|
||||
`tauri-runtime-cef` is also how the Tauri CLI detects a CEF app, which is what
|
||||
makes it ship the CEF binary distribution and, on macOS, run the app from inside
|
||||
an `.app` bundle in `tauri dev`:
|
||||
|
||||
```bash
|
||||
$ pnpm tauri dev --no-default-features --features cef
|
||||
```
|
||||
|
||||
The first build downloads the CEF binary distribution (about 1 GB) into
|
||||
`{user cache}/tauri-cef`, or into `$CEF_PATH` when that is set. The tray icon is
|
||||
not set up on CEF, which has no tray integration.
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"@iconify-json/codicon": "^1.2.49",
|
||||
"@iconify-json/ph": "^1.2.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||
"@tauri-apps/cli-cef": "3.0.0-alpha.6",
|
||||
"@tauri-apps/cli-cef": "3.0.0-alpha.26",
|
||||
"@unocss/extractor-svelte": "^66.6.7",
|
||||
"svelte": "^5.54.0",
|
||||
"unocss": "^66.6.7",
|
||||
|
||||
@@ -43,9 +43,7 @@ tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" }
|
||||
[dependencies.tauri]
|
||||
workspace = true
|
||||
features = [
|
||||
"wry",
|
||||
"common-controls-v6",
|
||||
"x11",
|
||||
"image-ico",
|
||||
"image-png",
|
||||
"isolation",
|
||||
@@ -54,6 +52,19 @@ features = [
|
||||
"protocol-asset",
|
||||
]
|
||||
|
||||
# The webview runtime is picked by depending on its crate and handing its
|
||||
# attributes to `tauri::Builder::runtime`. `macos-private-api` only reaches the
|
||||
# runtime when it is enabled on the runtime crate as well.
|
||||
[dependencies.tauri-runtime-wry]
|
||||
workspace = true
|
||||
optional = true
|
||||
features = ["common-controls-v6", "macos-private-api"]
|
||||
|
||||
[dependencies.tauri-runtime-cef]
|
||||
workspace = true
|
||||
optional = true
|
||||
features = ["macos-private-api"]
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.4.1" }
|
||||
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.3.2" }
|
||||
@@ -68,4 +79,7 @@ tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "
|
||||
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.3.2" }
|
||||
|
||||
[features]
|
||||
default = ["wry"]
|
||||
wry = ["dep:tauri-runtime-wry"]
|
||||
cef = ["dep:tauri-runtime-cef"]
|
||||
prod = ["tauri/custom-protocol"]
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
mod cmd;
|
||||
#[cfg(desktop)]
|
||||
// The CEF runtime has no tray icon integration, so the tray is only set up on
|
||||
// the wry runtime.
|
||||
#[cfg(all(desktop, not(feature = "cef")))]
|
||||
mod tray;
|
||||
|
||||
use serde::Serialize;
|
||||
@@ -20,10 +22,19 @@ struct Reply {
|
||||
pub type SetupHook = Box<dyn FnOnce(&mut App) -> Result<(), Box<dyn std::error::Error>> + Send>;
|
||||
pub type OnEvent = Box<dyn FnMut(&AppHandle, RunEvent)>;
|
||||
|
||||
// Every CEF application is also its own renderer, GPU, network and utility
|
||||
// process. This attribute runs the helper side of that and returns before the
|
||||
// Tauri application is built, for any process Chromium launched with `--type=`.
|
||||
#[cfg_attr(feature = "cef", tauri_runtime_cef::cef_entry_point)]
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[cfg(feature = "cef")]
|
||||
let builder = tauri::Builder::default().runtime(tauri_runtime_cef::Cef::default());
|
||||
#[cfg(not(feature = "cef"))]
|
||||
let builder = tauri::Builder::default().runtime(tauri_runtime_wry::Wry::default());
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = tauri::Builder::default()
|
||||
let mut builder = builder
|
||||
.plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.level(log::LevelFilter::Info)
|
||||
@@ -43,6 +54,7 @@ pub fn run() {
|
||||
.setup(move |app| {
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
#[cfg(not(feature = "cef"))]
|
||||
tray::create_tray(app.handle())?;
|
||||
app.handle().plugin(tauri_plugin_cli::init())?;
|
||||
app.handle()
|
||||
@@ -170,7 +182,9 @@ pub fn run() {
|
||||
app.set_activation_policy(tauri::ActivationPolicy::Regular);
|
||||
|
||||
app.run(move |_app_handle, _event| {
|
||||
#[cfg(desktop)]
|
||||
// Only the tray icon keeps this app useful without windows, and there is
|
||||
// no tray on CEF.
|
||||
#[cfg(all(desktop, not(feature = "cef")))]
|
||||
if let RunEvent::ExitRequested { code, api, .. } = &_event {
|
||||
if code.is_none() {
|
||||
// Keep the event loop running even if all windows are closed
|
||||
|
||||
Reference in New Issue
Block a user