Make the green full screen window icon maximize windows

When my application is running, I want to programmatically disable full screen system wide. I would like the green button to maximize the windows instead of going full screen. I see there are tools doing that, e.g. BetterTouchTool, RightZoom, so it's possible to do that. How to achieve that in swift/objective-C?

Make the green full screen window icon maximize windows
 
 
Q