@@ -10,10 +10,13 @@ use crate::window_manager::{WindowManager, NEW_UI_WINDOW_ID, OLD_UI_WINDOW_ID};
1010
1111#[ cfg( target_os = "macos" ) ]
1212use cocoa:: {
13- appkit:: { NSView , NSWindow , NSWindowStyleMask } ,
13+ appkit:: { NSView , NSWindow , NSWindowButton , NSWindowStyleMask , NSWindowTitleVisibility } ,
1414 base:: id,
1515} ;
1616
17+ #[ cfg( target_os = "macos" ) ]
18+ use objc:: { msg_send, sel, sel_impl} ;
19+
1720#[ cfg( target_os = "macos" ) ]
1821pub fn enable_rounded_corners < R : Runtime > ( window : WebviewWindow < R > ) -> Result < ( ) , String > {
1922 window
@@ -33,6 +36,26 @@ pub fn enable_rounded_corners<R: Runtime>(window: WebviewWindow<R>) -> Result<()
3336 ns_window. setStyleMask_ ( style_mask) ;
3437 ns_window. setTitlebarAppearsTransparent_ ( cocoa:: base:: YES ) ;
3538
39+ // Hide the window title
40+ ns_window. setTitleVisibility_ ( NSWindowTitleVisibility :: NSWindowTitleHidden ) ;
41+
42+ // Hide the standard window buttons (close, minimize, zoom)
43+ let close_button =
44+ ns_window. standardWindowButton_ ( NSWindowButton :: NSWindowCloseButton ) ;
45+ if !close_button. is_null ( ) {
46+ let _: ( ) = msg_send ! [ close_button, setHidden: cocoa:: base:: YES ] ;
47+ }
48+ let miniaturize_button =
49+ ns_window. standardWindowButton_ ( NSWindowButton :: NSWindowMiniaturizeButton ) ;
50+ if !miniaturize_button. is_null ( ) {
51+ let _: ( ) = msg_send ! [ miniaturize_button, setHidden: cocoa:: base:: YES ] ;
52+ }
53+ let zoom_button =
54+ ns_window. standardWindowButton_ ( NSWindowButton :: NSWindowZoomButton ) ;
55+ if !zoom_button. is_null ( ) {
56+ let _: ( ) = msg_send ! [ zoom_button, setHidden: cocoa:: base:: YES ] ;
57+ }
58+
3659 let content_view = ns_window. contentView ( ) ;
3760 content_view. setWantsLayer ( cocoa:: base:: YES ) ;
3861 }
0 commit comments