Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the Proxy Icon in the bar of my mac app

I was wondering how to remove the proxy icon in the bar of my mac app. I've added an image so you can see what Icon I'm talking about

enter image description here

Thank you in advance!

like image 295
Tapy Avatar asked Dec 05 '25 01:12

Tapy


1 Answers

The icon is included in the titlebar of the application automatically when you've created an NSDocument based application.

You can remove the proxy icon by returning nil from the -[NSWindow representedURL] method. This could be accomplished by using a custom NSWindow subclass with the method overridden; or simply setting the property to nil at the appropriate times.

Be aware, you might loose other functionality you normally get for free by changing this behavior, such as the dirty/clean indicator for the window, or some prompting to save when closing the window.

Alternatively, if you wanted a different image, you could use:

[[NSWindow standardWindowButton:NSWindowDocumentIconButton] setImage:customImage]

Then implement -[id<NSWindowDelegate> window:shouldPopUpDocumentPathMenu:] to return NO to prevent the popup menu from appearing.

If your application isn't actually document based, or the window doesn't represent a document, consider refactoring to present this window a different way, rather than being a document window.

There is some additional information in the Cocoa window documentation.

like image 175
Joey Hagedorn Avatar answered Dec 06 '25 17:12

Joey Hagedorn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!