pub struct WebViewRenderer { /* private fields */ }Expand description
WebView-based renderer using wry + tao.
Platform backends:
- Windows: WebView2 (Edge Chromium)
- macOS: WKWebView (WebKit)
- Linux: WebKitGTK
§Frameless / Custom Title Bar
Set decorations = false in WindowConfig to create a frameless window.
The frontend can use window.__RDESKTOP_WINDOW__ to control the window:
window.__RDESKTOP_WINDOW__.minimize()
window.__RDESKTOP_WINDOW__.maximize()
window.__RDESKTOP_WINDOW__.close()
window.__RDESKTOP_WINDOW__.startDrag() // drag from custom title bar
window.__RDESKTOP_WINDOW__.startResize('bottom-right') // resize from edgeImplementations§
Source§impl WebViewRenderer
impl WebViewRenderer
pub fn new(config: &AppConfig) -> Result<Self>
Sourcepub fn set_asset_root(&mut self, root: impl Into<PathBuf>) -> Result<()>
pub fn set_asset_root(&mut self, root: impl Into<PathBuf>) -> Result<()>
Register a local directory as the renderer’s rdesktop:// asset root.
Native WebViews cannot reliably load Vite module assets from
file:// or NavigateToString() because of origin and module-CORS
rules. Serving the built frontend through a framework-owned protocol
gives the page a stable origin on every desktop backend.
Sourcepub fn set_data_directory(
&mut self,
directory: impl Into<PathBuf>,
) -> Result<()>
pub fn set_data_directory( &mut self, directory: impl Into<PathBuf>, ) -> Result<()>
Store WebView cookies, localStorage, IndexedDB, and cache outside the executable directory.
Windows portable applications should point this at a preserved per-user
directory (for example %LOCALAPPDATA%/<product>/WebView2). Otherwise
WebView2 defaults beside the executable can be lost during a clean
application update. The path must be absolute; Wry/WebView2 creates it
when the first WebView starts.