I am creating an OS X status bar application, so I want the application to start hidden.
I have created a "storyboard" application, and the initial window always shows up, even if "Visible at launch" is unchecked (was unchecked by default).
Note: if I disable "Is initial controller" then the app correctly starts without any window, but my (now orphan) window seems to never be added to the storyboard:
var mainWindow = NSStoryboard(name: "Main", bundle: nil)?.instantiateControllerWithIdentifier("mainWindow")
The "mainWindow" controller is not found (even though I correctly set "Storyboard ID" on the Window Controller).
So I think it's better to leave "Is initial controller" but simply have the main window hidden at the start…
Command-H: Hide the windows of the front app. To view the front app but hide all other apps, press Option-Command-H. Command-M: Minimize the front window to the Dock. To minimize all windows of the front app, press Option-Command-M.
Updated at 07 Feb, 2022 07:25 PM. If you want Tot's window to float above other windows on the Mac desktop, use the "Display as Floating Window" item in the Window menu. Note that the Window menu is only visible when you're using Tot with a Dock icon.
Open the window you want it to be on top. Then, click CTRL + SPACE. Then, you will see that the window will stay on top no matter which app you open later. 10.
Uncheck "Is Initial Controller", but then you need to set the storyboard and its associated NSWindowController
manually.
The precise way of doing that is shown in this answer, which I'll quote here:
[...] in your
AppDelegate
, set up a property for the window controller:@property NSWindowController *myController;
In your
applicationDidFinishLaunching:
method implementation, create a reference to the Storyboard. This way you get access your window controller from the storyboard. After that, the only thing left to do is to display the window by sending your window controller theshowWindow:
method.
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
@synthesize myController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// get a reference to the storyboard
NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
// instantiate your window controller
myController = [storyBoard instantiateControllerWithIdentifier:@"secondWindowController"];
// show the window
[myController showWindow:self];
}
@end
Uncheck the "Is Initial Controller" box on the storyboard, leaving your app without an initial controller. Your app will run, but will have no window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With