@@ -1363,6 +1363,8 @@ pub enum Message<T: 'static> {
13631363 Task ( Box < dyn FnOnce ( ) + Send > ) ,
13641364 #[ cfg( target_os = "macos" ) ]
13651365 SetActivationPolicy ( ActivationPolicy ) ,
1366+ #[ cfg( target_os = "macos" ) ]
1367+ SetDockVisibility ( bool ) ,
13661368 RequestExit ( i32 ) ,
13671369 Application ( ApplicationMessage ) ,
13681370 Window ( WindowId , WindowMessage ) ,
@@ -2435,6 +2437,11 @@ impl<T: UserEvent> RuntimeHandle<T> for WryHandle<T> {
24352437 )
24362438 }
24372439
2440+ #[ cfg( target_os = "macos" ) ]
2441+ fn set_dock_visibility ( & self , visible : bool ) -> Result < ( ) > {
2442+ send_user_message ( & self . context , Message :: SetDockVisibility ( visible) )
2443+ }
2444+
24382445 fn request_exit ( & self , code : i32 ) -> Result < ( ) > {
24392446 // NOTE: request_exit cannot use the `send_user_message` function because it accesses the event loop callback
24402447 self
@@ -2844,6 +2851,11 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
28442851 . set_activation_policy ( tao_activation_policy ( activation_policy) ) ;
28452852 }
28462853
2854+ #[ cfg( target_os = "macos" ) ]
2855+ fn set_dock_visibility ( & mut self , visible : bool ) {
2856+ self . event_loop . set_dock_visibility ( visible) ;
2857+ }
2858+
28472859 #[ cfg( target_os = "macos" ) ]
28482860 fn show ( & self ) {
28492861 self . event_loop . show_application ( ) ;
@@ -3018,6 +3030,8 @@ fn handle_user_message<T: UserEvent>(
30183030 Message :: SetActivationPolicy ( activation_policy) => {
30193031 event_loop. set_activation_policy_at_runtime ( tao_activation_policy ( activation_policy) )
30203032 }
3033+ #[ cfg( target_os = "macos" ) ]
3034+ Message :: SetDockVisibility ( visible) => event_loop. set_dock_visibility ( visible) ,
30213035 Message :: RequestExit ( _code) => panic ! ( "cannot handle RequestExit on the main thread" ) ,
30223036 Message :: Application ( application_message) => match application_message {
30233037 #[ cfg( target_os = "macos" ) ]
0 commit comments