{"id":13465569,"url":"https://github.com/tauri-apps/wry","last_synced_at":"2026-01-16T23:01:39.700Z","repository":{"id":37012609,"uuid":"279089942","full_name":"tauri-apps/wry","owner":"tauri-apps","description":"Cross-platform WebView library in Rust for Tauri.","archived":false,"fork":false,"pushed_at":"2025-05-02T15:29:56.000Z","size":9527,"stargazers_count":4097,"open_issues_count":121,"forks_count":330,"subscribers_count":40,"default_branch":"dev","last_synced_at":"2025-05-12T02:46:13.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tauri-apps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":"audits/Radically_Open_Security-v1-report.pdf","citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":"tauri","ko_fi":null,"tidelift":null,"custom":null}},"created_at":"2020-07-12T15:12:44.000Z","updated_at":"2025-05-11T22:47:35.000Z","dependencies_parsed_at":"2023-01-17T13:06:42.769Z","dependency_job_id":"eb33133c-981d-4422-b985-c0125211f88a","html_url":"https://github.com/tauri-apps/wry","commit_stats":{"total_commits":940,"total_committers":100,"mean_commits":9.4,"dds":0.7510638297872341,"last_synced_commit":"72212568cb4d815463fc035969f9cac60fe28ba6"},"previous_names":[],"tags_count":174,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tauri-apps%2Fwry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tauri-apps%2Fwry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tauri-apps%2Fwry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tauri-apps%2Fwry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tauri-apps","download_url":"https://codeload.github.com/tauri-apps/wry/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672734,"owners_count":21945482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:00:32.019Z","updated_at":"2026-01-16T23:01:39.667Z","avatar_url":"https://github.com/tauri-apps.png","language":"Rust","funding_links":["https://opencollective.com/tauri"],"categories":["About","Rust","Libraries","库 Libraries","WebView","others"],"sub_categories":["Project design","GUI","GUI GUI","ORM"],"readme":"\u003cp align=\"center\"\u003e\u003cimg height=\"100\" src=\"https://raw.githubusercontent.com/tauri-apps/wry/refs/heads/dev/.github/splash.png\" alt=\"WRY Webview Rendering library\" /\u003e\u003c/p\u003e\n\n[![](https://img.shields.io/crates/v/wry?style=flat-square)](https://crates.io/crates/wry) [![](https://img.shields.io/docsrs/wry?style=flat-square)](https://docs.rs/wry/)\n[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)\n[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)\n[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)\n[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)\n[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri)\n\nWry is a cross-platform WebView rendering library.\n\nThe webview requires a running event loop and a window type that implements [`HasWindowHandle`],\nor a gtk container widget if you need to support X11 and Wayland.\nYou can use a windowing library like [`tao`] or [`winit`].\n\n### Examples\n\nThis example leverages the [`HasWindowHandle`] and supports Windows, macOS, iOS, Android and Linux (X11 Only).\nSee the following example using [`winit`]:\n\n```rust\n#[derive(Default)]\nstruct App {\n  window: Option\u003cWindow\u003e,\n  webview: Option\u003cwry::WebView\u003e,\n}\n\nimpl ApplicationHandler for App {\n  fn resumed(\u0026mut self, event_loop: \u0026ActiveEventLoop) {\n    let window = event_loop.create_window(Window::default_attributes()).unwrap();\n    let webview = WebViewBuilder::new()\n      .with_url(\"https://tauri.app\")\n      .build(\u0026window)\n      .unwrap();\n\n    self.window = Some(window);\n    self.webview = Some(webview);\n  }\n\n  fn window_event(\u0026mut self, _event_loop: \u0026ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}\n}\n\nlet event_loop = EventLoop::new().unwrap();\nlet mut app = App::default();\nevent_loop.run_app(\u0026mut app).unwrap();\n```\n\nIf you also want to support Wayland too, then we recommend you use [`WebViewBuilderExtUnix::new_gtk`] on Linux.\nSee the following example using [`tao`]:\n\n```rust\nlet event_loop = EventLoop::new();\nlet window = WindowBuilder::new().build(\u0026event_loop).unwrap();\n\nlet builder = WebViewBuilder::new().with_url(\"https://tauri.app\");\n\n#[cfg(not(target_os = \"linux\"))]\nlet webview = builder.build(\u0026window).unwrap();\n#[cfg(target_os = \"linux\")]\nlet webview = builder.build_gtk(window.gtk_window()).unwrap();\n```\n\n### Child webviews\n\nYou can use [`WebView::new_as_child`] or [`WebViewBuilder::new_as_child`] to create the webview as a child inside another window. This is supported on\nmacOS, Windows and Linux (X11 Only).\n\n```rust\n#[derive(Default)]\nstruct App {\n  window: Option\u003cWindow\u003e,\n  webview: Option\u003cwry::WebView\u003e,\n}\n\nimpl ApplicationHandler for App {\n  fn resumed(\u0026mut self, event_loop: \u0026ActiveEventLoop) {\n    let window = event_loop.create_window(Window::default_attributes()).unwrap();\n    let webview = WebViewBuilder::new()\n      .with_url(\"https://tauri.app\")\n      .with_bounds(Rect {\n        position: LogicalPosition::new(100, 100).into(),\n        size: LogicalSize::new(200, 200).into(),\n      })\n      .build_as_child(\u0026window)\n      .unwrap();\n\n    self.window = Some(window);\n    self.webview = Some(webview);\n  }\n\n  fn window_event(\u0026mut self, _event_loop: \u0026ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}\n}\n\nlet event_loop = EventLoop::new().unwrap();\nlet mut app = App::default();\nevent_loop.run_app(\u0026mut app).unwrap();\n```\n\nIf you want to support X11 and Wayland at the same time, we recommend using\n[`WebViewExtUnix::new_gtk`] or [`WebViewBuilderExtUnix::new_gtk`] with [`gtk::Fixed`].\n\n```rust\nlet event_loop = EventLoop::new();\nlet window = WindowBuilder::new().build(\u0026event_loop).unwrap();\n\nlet builder = WebViewBuilder::new()\n  .with_url(\"https://tauri.app\")\n  .with_bounds(Rect {\n    position: LogicalPosition::new(100, 100).into(),\n    size: LogicalSize::new(200, 200).into(),\n  });\n\n#[cfg(not(target_os = \"linux\"))]\nlet webview = builder.build_as_child(\u0026window).unwrap();\n#[cfg(target_os = \"linux\")]\nlet webview = {\n  # use gtk::prelude::*;\n  let vbox = window.default_vbox().unwrap(); // tao adds a gtk::Box by default\n  let fixed = gtk::Fixed::new();\n  fixed.show_all();\n  vbox.pack_start(\u0026fixed, true, true, 0);\n  builder.build_gtk(\u0026fixed).unwrap()\n};\n```\n\n### Platform Considerations\n\nHere is the underlying web engine each platform uses, and some dependencies you might need to install.\n\n#### Linux\n\n[WebKitGTK](https://webkitgtk.org/) is used to provide webviews on Linux which requires GTK,\nso if the windowing library doesn't support GTK (as in [`winit`])\nyou'll need to call [`gtk::init`] before creating the webview and then call [`gtk::main_iteration_do`] alongside\nyour windowing library event loop.\n\n```rust\n#[derive(Default)]\nstruct App {\n  webview_window: Option\u003c(Window, WebView)\u003e,\n}\n\nimpl ApplicationHandler for App {\n  fn resumed(\u0026mut self, event_loop: \u0026ActiveEventLoop) {\n    let window = event_loop.create_window(Window::default_attributes()).unwrap();\n    let webview = WebViewBuilder::new()\n      .with_url(\"https://tauri.app\")\n      .build(\u0026window)\n      .unwrap();\n\n    self.webview_window = Some((window, webview));\n  }\n\n  fn window_event(\u0026mut self, _event_loop: \u0026ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}\n\n  // Advance GTK event loop \u003c!----- IMPORTANT\n  fn about_to_wait(\u0026mut self, _event_loop: \u0026ActiveEventLoop) {\n    #[cfg(target_os = \"linux\")]\n    while gtk::events_pending() {\n      gtk::main_iteration_do(false);\n    }\n  }\n}\n\nlet event_loop = EventLoop::new().unwrap();\nlet mut app = App::default();\nevent_loop.run_app(\u0026mut app).unwrap();\n```\n\n##### Linux Dependencies\n\n###### Arch Linux / Manjaro:\n\n```bash\nsudo pacman -S webkit2gtk-4.1\n```\n\n###### Debian / Ubuntu:\n\n```bash\nsudo apt install libwebkit2gtk-4.1-dev\n```\n\n###### Fedora\n\n```bash\nsudo dnf install gtk3-devel webkit2gtk4.1-devel\n```\n\n###### Nix \u0026 NixOS\n\n```nix\n# shell.nix\n\nlet\n   # Unstable Channel | Rolling Release\n   pkgs = import (fetchTarball(\"channel:nixpkgs-unstable\")) { };\n   packages = with pkgs; [\n     pkg-config\n     webkitgtk_4_1\n   ];\n in\n pkgs.mkShell {\n   buildInputs = packages;\n }\n```\n\n```sh\nnix-shell shell.nix\n```\n\n###### GUIX\n\n```scheme\n;; manifest.scm\n\n(specifications-\u003emanifest\n  '(\"pkg-config\"                ; Helper tool used when compiling\n    \"webkitgtk\"                 ; Web content engine fot GTK+\n ))\n```\n\n```bash\nguix shell -m manifest.scm\n```\n\n#### macOS\n\nWebKit is native on macOS so everything should be fine.\n\nIf you are cross-compiling for macOS using [osxcross](https://github.com/tpoechtrager/osxcross) and encounter a runtime panic like `Class with name WKWebViewConfiguration could not be found` it's possible that `WebKit.framework` has not been linked correctly, to fix this set the `RUSTFLAGS` environment variable:\n\n```bash\nRUSTFLAGS=\"-l framework=WebKit\" cargo build --target=x86_64-apple-darwin --release\n```\n\n#### Windows\n\nWebView2 provided by Microsoft Edge Chromium is used. So wry supports Windows 7, 8, 10 and 11.\n\n#### Android\n\nIn order for `wry` to be able to create webviews on Android, there are a few requirements that your application needs to uphold:\n\n1. You need to set a few environment variables that will be used to generate the necessary kotlin\n   files that you need to include in your Android application for wry to function properly.\n   - `WRY_ANDROID_PACKAGE`: which is the reversed domain name of your android project and the app name in snake_case, for example, `com.wry.example.wry_app`\n   - `WRY_ANDROID_LIBRARY`: for example, if your cargo project has a lib name `wry_app`, it will generate `libwry_app.so` so you set this env var to `wry_app`\n   - `WRY_ANDROID_KOTLIN_FILES_OUT_DIR`: for example, `path/to/app/src/main/kotlin/com/wry/example`\n2. Your main Android Activity needs to inherit `AppCompatActivity`, preferably it should use the generated `WryActivity` or inherit it.\n3. Your Rust app needs to call `wry::android_setup` function to setup the necessary logic to be able to create webviews later on.\n4. Your Rust app needs to call `wry::android_binding!` macro to setup the JNI functions that will be called by `WryActivity` and various other places.\n\nIt is recommended to use the [`tao`](https://docs.rs/tao/latest/tao/) crate as it provides maximum compatibility with `wry`.\n\n```rust\n#[cfg(target_os = \"android\")]\n{\n  tao::android_binding!(\n      com_example,\n      wry_app,\n      WryActivity,\n      wry::android_setup, // pass the wry::android_setup function to tao which will be invoked when the event loop is created\n      _start_app\n  );\n  wry::android_binding!(com_example, ttt);\n}\n```\n\nIf this feels overwhelming, you can just use the preconfigured template from [`cargo-mobile2`](https://github.com/tauri-apps/cargo-mobile2).\n\nFor more information, check out [MOBILE.md](https://github.com/tauri-apps/wry/blob/dev/MOBILE.md).\n\n### Feature flags\n\nWry uses a set of feature flags to toggle several advanced features.\n\n- `os-webview` (default): Enables the default WebView framework on the platform. This must be enabled\n  for the crate to work. This feature was added in preparation of other ports like cef and servo.\n- `protocol` (default): Enables [`WebViewBuilder::with_custom_protocol`] to define custom URL scheme for handling tasks like\n  loading assets.\n- `drag-drop` (default): Enables [`WebViewBuilder::with_drag_drop_handler`] to control the behavior when there are files\n  interacting with the window.\n- `devtools`: Enables devtools on release builds. Devtools are always enabled in debug builds.\n  On **macOS**, enabling devtools, requires calling private APIs so you should not enable this flag in release\n  build if your app needs to publish to App Store.\n- `transparent`: Transparent background on **macOS** requires calling private functions.\n  Avoid this in release build if your app needs to publish to App Store.\n- `fullscreen`: Fullscreen video and other media on **macOS** requires calling private functions.\n  Avoid this in release build if your app needs to publish to App Store.\n- `linux-body`: Enables body support of custom protocol request on Linux. Requires\n  WebKit2GTK v2.40 or above.\n- `tracing`: enables [`tracing`] for `evaluate_script`, `ipc_handler`, and `custom_protocols`.\n\n### Partners\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"middle\"\u003e\n        \u003ca href=\"https://crabnebula.dev\" target=\"_blank\"\u003e\n          \u003cimg src=\".github/sponsors/crabnebula.svg\" alt=\"CrabNebula\" width=\"283\"\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\nFor the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).\n\n### License\n\nApache-2.0/MIT\n\n[`tao`]: https://docs.rs/tao\n[`winit`]: https://docs.rs/winit\n[`tracing`]: https://docs.rs/tracing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftauri-apps%2Fwry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftauri-apps%2Fwry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftauri-apps%2Fwry/lists"}