Today I was asked how to draw over the whole window in Cocoa. Well it looks like you can simply add a view to NSWindowsMBS.contentview.superview to be able to draw over the whole window, even the title bar. And you can add a button there like on this screenshot:
You simply create a button and use w.contentView.superview.addSubview to add it to the window.
Example project: View in Titlebar.zip