Hide standard window buttons

How do I permanently hide the standard window buttons(Buttons on top left; close, minimize and zoom)

In my app, I hide the standard buttons and put my own custom buttons. Some users have reported that the standard buttons appear again making the app look buggy and confuses the users

At present I use following code to remove the buttons

standardWindowButton(.closeButton)?.removeFromSuperview()
standardWindowButton(.miniaturizeButton)?.removeFromSuperview()
standardWindowButton(.zoomButton)?.removeFromSuperview()
}

I have to call this code from multiple places like on window initialization, when appearance changes and when the window size changes.

I tried creating window without the titled stylemask, but it has other down sides like the standard window decoration is entirely skipped by the system. The resizing also is unpredictable.

My question is, what is the right way to remove/hide the standard window buttons?

Answered by mmunz in 893453022

I mark the buttons as hidden and only need to do it on setup of the window.

standardWindowButton(.closeButton)?.isHidden = true
standardWindowButton(.miniaturizeButton)?.isHidden = true
standardWindowButton(.zoomButton)?.isHidden = true
Accepted Answer

I mark the buttons as hidden and only need to do it on setup of the window.

standardWindowButton(.closeButton)?.isHidden = true
standardWindowButton(.miniaturizeButton)?.isHidden = true
standardWindowButton(.zoomButton)?.isHidden = true
Hide standard window buttons
 
 
Q