@@ -64,7 +64,7 @@ use wry::{
6464 } ,
6565 } ,
6666 http:: { Request as WryRequest , Response as WryResponse } ,
67- webview:: { FileDropEvent as WryFileDropEvent , WebContext , WebView , WebViewBuilder } ,
67+ webview:: { FileDropEvent as WryFileDropEvent , Url , WebContext , WebView , WebViewBuilder } ,
6868} ;
6969
7070pub use wry:: application:: window:: { Window , WindowBuilder as WryWindowBuilder , WindowId } ;
@@ -1037,6 +1037,7 @@ pub enum WindowMessage {
10371037 #[ cfg( any( debug_assertions, feature = "devtools" ) ) ]
10381038 IsDevToolsOpen ( Sender < bool > ) ,
10391039 // Getters
1040+ Url ( Sender < Url > ) ,
10401041 ScaleFactor ( Sender < f64 > ) ,
10411042 InnerPosition ( Sender < Result < PhysicalPosition < i32 > > > ) ,
10421043 OuterPosition ( Sender < Result < PhysicalPosition < i32 > > > ) ,
@@ -1238,6 +1239,10 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
12381239
12391240 // Getters
12401241
1242+ fn url ( & self ) -> Result < Url > {
1243+ window_getter ! ( self , WindowMessage :: Url )
1244+ }
1245+
12411246 fn scale_factor ( & self ) -> Result < f64 > {
12421247 window_getter ! ( self , WindowMessage :: ScaleFactor )
12431248 }
@@ -2362,6 +2367,11 @@ fn handle_user_message<T: UserEvent>(
23622367 }
23632368 }
23642369 // Getters
2370+ WindowMessage :: Url ( tx) => {
2371+ if let WindowHandle :: Webview { inner : w, .. } = & window {
2372+ tx. send ( w. url ( ) ) . unwrap ( ) ;
2373+ }
2374+ }
23652375 WindowMessage :: ScaleFactor ( tx) => tx. send ( window. scale_factor ( ) ) . unwrap ( ) ,
23662376 WindowMessage :: InnerPosition ( tx) => tx
23672377 . send (
0 commit comments