Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: bring WebViewExt into scope for Linux history navigation

Tw93641e56e77e03
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 028b7e3e..e04a5711 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2584,6 +2584,7 @@ dependencies = [
"tauri-plugin-single-instance",
"tauri-plugin-window-state",
"tokio",
+ "webkit2gtk",
"webview2-com",
"windows-sys 0.61.2",
]
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 70d41738..eb4fcace 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -42,6 +42,12 @@ objc2 = "0.6"
objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSDockTile"] }
objc2-foundation = { version = "0.3", features = ["NSString"] }
+[target.'cfg(target_os = "linux")'.dependencies]
+# Used for native WebKitGTK go_back/go_forward on error pages (no page JS).
+# Version and features must match what wry resolves, or PlatformWebview::inner
+# hands back a WebView from a different crate instance.
+webkit2gtk = { version = "=2.0.2", features = ["v2_38"] }
+
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61.2", features = [
"Win32_Foundation",
diff --git a/src-tauri/src/app/navigation.rs b/src-tauri/src/app/navigation.rs
index 43168984..0a5e8e98 100644
--- a/src-tauri/src/app/navigation.rs
+++ b/src-tauri/src/app/navigation.rs
@@ -51,6 +51,8 @@ fn history_step_platform(webview: &tauri::webview::PlatformWebview, back: bool)
#[cfg(target_os = "linux")]
fn history_step_platform(webview: &tauri::webview::PlatformWebview, back: bool) {
+ use webkit2gtk::WebViewExt;
+
let gtk_webview = webview.inner();
if back {
gtk_webview.go_back();