diff --git a/src/main.rs b/src/main.rs index 94c549c..bde4387 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,7 +71,22 @@ fn main() -> wry::Result<()> { .with_decorations(true) .build(&event_loop) .unwrap(); - let _webview = WebViewBuilder::new(&window) + + let webview_builder = if cfg!(not(any( + target_os = "windows", + target_os = "macos", + target_os = "ios", + target_os = "android", + ))) { + use tao::platform::unix::WindowExtUnix; + use wry::WebViewBuilderExtUnix; + let vbox = window.default_vbox().unwrap(); + WebViewBuilder::new_gtk(vbox) + } else { + WebViewBuilder::new(&window) + }; + + let _webview = webview_builder .with_custom_protocol(SCHEME.to_string(), move |r| handler(log, &args, r)) .with_url(BASE) .with_devtools(true) diff --git a/vega.nu b/vega.nu index c2cbc70..78058e1 100644 --- a/vega.nu +++ b/vega.nu @@ -142,4 +142,4 @@ export def flip [] { let x = $spec.encoding.x? let y = $spec.encoding.y? $spec | upsert encoding.y $x | upsert encoding.x $y -} \ No newline at end of file +}