@@ -54,8 +54,8 @@ mod commands {
5454 use super :: * ;
5555 use crate :: {
5656 command, sealed:: ManagerBase , utils:: config:: WindowConfig , window:: Color ,
57- window:: WindowBuilder , AppHandle , PhysicalPosition , PhysicalSize , Position , Size , Theme ,
58- Window ,
57+ window:: WindowBuilder , AppHandle , Monitor , PhysicalPosition , PhysicalSize , Position , Size ,
58+ Theme , Window ,
5959 } ;
6060
6161 #[ command( root = "crate" ) ]
@@ -102,6 +102,21 @@ mod commands {
102102 setter ! ( set_size_constraints, WindowSizeConstraints ) ;
103103 setter ! ( set_theme, Option <Theme >) ;
104104 setter ! ( set_enabled, bool ) ;
105+
106+ getter ! ( current_monitor, Option <Monitor >) ;
107+ getter ! ( primary_monitor, Option <Monitor >) ;
108+ getter ! ( available_monitors, Vec <Monitor >) ;
109+
110+ #[ command( root = "crate" ) ]
111+ pub async fn monitor_from_point < R : Runtime > (
112+ window : Window < R > ,
113+ label : Option < String > ,
114+ x : f64 ,
115+ y : f64 ,
116+ ) -> crate :: Result < Option < Monitor > > {
117+ let window = get_window ( window, label) ?;
118+ window. monitor_from_point ( x, y)
119+ }
105120}
106121
107122#[ cfg( desktop) ]
@@ -112,7 +127,7 @@ mod desktop_commands {
112127 use super :: * ;
113128 use crate :: {
114129 command, utils:: config:: WindowEffectsConfig , window:: ProgressBarState , CursorIcon , Manager ,
115- Monitor , PhysicalPosition , Position , UserAttentionType , Webview ,
130+ PhysicalPosition , Position , UserAttentionType , Webview ,
116131 } ;
117132
118133 getter ! ( is_fullscreen, bool ) ;
@@ -122,9 +137,6 @@ mod desktop_commands {
122137 getter ! ( is_maximizable, bool ) ;
123138 getter ! ( is_minimizable, bool ) ;
124139 getter ! ( is_closable, bool ) ;
125- getter ! ( current_monitor, Option <Monitor >) ;
126- getter ! ( primary_monitor, Option <Monitor >) ;
127- getter ! ( available_monitors, Vec <Monitor >) ;
128140 getter ! ( cursor_position, PhysicalPosition <f64 >) ;
129141 getter ! ( is_always_on_top, bool ) ;
130142
@@ -217,17 +229,6 @@ mod desktop_commands {
217229 }
218230 Ok ( ( ) )
219231 }
220-
221- #[ command( root = "crate" ) ]
222- pub async fn monitor_from_point < R : Runtime > (
223- window : Window < R > ,
224- label : Option < String > ,
225- x : f64 ,
226- y : f64 ,
227- ) -> crate :: Result < Option < Monitor > > {
228- let window = get_window ( window, label) ?;
229- window. monitor_from_point ( x, y)
230- }
231232}
232233
233234/// Initializes the plugin.
@@ -291,6 +292,10 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
291292 commands:: set_enabled,
292293 commands:: set_background_color,
293294 commands:: set_theme,
295+ commands:: current_monitor,
296+ commands:: primary_monitor,
297+ commands:: monitor_from_point,
298+ commands:: available_monitors,
294299
295300 #[ cfg( desktop) ] desktop_commands:: is_fullscreen,
296301 #[ cfg( desktop) ] desktop_commands:: is_minimized,
@@ -299,10 +304,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
299304 #[ cfg( desktop) ] desktop_commands:: is_maximizable,
300305 #[ cfg( desktop) ] desktop_commands:: is_minimizable,
301306 #[ cfg( desktop) ] desktop_commands:: is_closable,
302- #[ cfg( desktop) ] desktop_commands:: current_monitor,
303- #[ cfg( desktop) ] desktop_commands:: primary_monitor,
304- #[ cfg( desktop) ] desktop_commands:: monitor_from_point,
305- #[ cfg( desktop) ] desktop_commands:: available_monitors,
307+
306308 #[ cfg( desktop) ] desktop_commands:: cursor_position,
307309 #[ cfg( desktop) ] desktop_commands:: is_always_on_top,
308310 // setters
0 commit comments