How do you programmatically hide the menu bar in a cocoa app? I would like to make full use of the screen area.
How do you hide the menu bar in a Cocoa app?
4.1k Views Asked by uchuugaka At
2
There are 2 best solutions below
Related Questions in OBJECTIVE-C
- How to control the volume of an iPhone programmatically in objective-c
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- How to set value the descriptor of iOS BLE in Objective-C?
- Unexpected #selector() Behavior in Swift-Objective-C Interop?
- In what context can we use an unqualified #selector() expression in Swift?
- AVPictureInPictureController crashes during initialization
- How to use pow() in Objective-C?
- How to change the image on the MGSwipeButton in MGSwipeTableCell
- Using sort descriptors in Outline View
- Why is my Swift function not printing from inside the dataTask closure?
- Using UICollectionViewCell with IBOutlet
- Undefined symbol: _OBJC_CLASS_$_ only on simulator
- Why can't I receive a notification sent from Camera Extension(Swift) to an observer application (obj-c++)
- Behavior of __block modifier in objc
- Inserting subview into view where I've added subviews and sublayers
Related Questions in COCOA
- In what context can we use an unqualified #selector() expression in Swift?
- How can I trigger macOS system gamepad API based on a value received from iOS app through core bluetooth
- Using sort descriptors in Outline View
- NSTableView to NSOutlineView Drag & Drop not accepting drop
- How to remove horizontal line in bottom of section NSTableView?
- CGSRegionRef: How is an arbitrary region represented as union of rects?
- Listen for Touch Events on MacOS (Trackpad)
- Window "yanks" when moving
- Writing NSFilePromiseProviders to pasteboard blocks app on quit
- Basic ImGui program doesn't render, leaks memory and crashes
- NSTokenField suggestion using context menu in swift
- How to link multiple text views to a single text storage in TextKit 2
- I would like to know why I’m not getting IBOutlets connected in an App’s window
- How to make a custom event loop in Cocoa?
- Why is restoreWindow(withIdentifier:state:) called after applicationDidFinishLaunching(_:)?
Related Questions in MENUBAR
- How to remove menu bar from the window that opens with an external URL of an Electron application
- how can i split Nav menu item with border: 3px in Divi theme?
- How to set menu bar color in win32?
- Menubar not visible in the latest version of VS Code (1.86) on mac (14.3)
- What's the syntax of clsx to add two classNames when one condition satisfied?
- MacOS swiftUI using NavigationStack toolbar button not showing in MenuBarExtra app
- how we can give a div scroll for touch and for windows?
- How do I make a Gtk4 application with a menu bar in Vala?
- Unremovable Empty “View” Menu Bar Container
- Selectively Removing Default Menu Bar Menus (like File, Edit, and View) in macOS App Using SwiftUI
- Tkinter MenuBar malfunctioning on Mac when switching frames
- Cannot select submenus from menubar using SwiftUI on macOS14
- .NET MAUI MacCatalyst Menu Bar items count problem
- How to achieve real-time SwiftUI Interface updates for variable changes in macOS Menu Bar?
- How to make a responsive MenuBar component of PRIMENG with grid system?
Related Questions in DOCK
- Using AppleScript (or Python PyObjC) to list out all applications in the Dock on Mac (All parts)
- delphi devexpress how to dock Tform in dxdockpanel at runetime (SDI project)
- com.apple.dock.plist is changed in macOS14.0 and later
- adding recent open document list in non document based app
- How add new options to the dock icon menu
- The LSUIElement key in Info.plist is being ignored (AvaloniaUI, net7.0-macos)
- Can I make a macOS app made of Python script behave in the Dock like normal apps do?
- How to hide the Dock Icon in Jetpack Compose Desktop?
- How to set an icon for an executable that isn't the app's main CFBundleExecutable?
- Why can't find ffmpeg || ffprobe error in Docker build even locally it's working fine
- KDE/Qt5 Minimize animation wrong target with own dock application
- Multiple dock icons for single Electron app?
- composer install command not working while installing cattr
- How to make sure that my app icon does not stay in the "recently used apps" on the Dock?
- dock video appear when scoll and disappear when next article is in the viewport
Related Questions in NSMENU
- Why is a dummy NSMenuItem needed to make the next NSMenuItem actually appear?
- NSMenuItem not clickable after updating to Sonoma
- How to use SwiftUI in NSMenu?
- Unable to dismiss "NSWindowController" for a Mac app
- NSCollectionView inside NSMenu don‘t update properly when menu not shown
- Displaying NSMenuItem in SwiftUI on it's own
- NSMenu Subclass does not respond to mouse click
- Application main NSMenu not responding without window reactivation
- MacOS Cocoa Detect When Keyboard Macro Program Presses Modifier Keys
- refresh NSMenuItem on click/open of NSStatusItem
- NSMenuItem.separator() is a blank space rather than a line
- Swift NSMenu items are grey out
- How to customize a NSPopUpButton and its NSMenu?
- Show NSMenu when clicking on a Button in SwiftUI view
- Disable clicking on FinderSync extension submenu
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There are two good ways I know of to do this.
1 In Cocoa, you can call the NSMenu class method
setMenuBarVisible:to show or hide the menu bar.As of this writing, the documentation for the NSMenu class does not tell you the following additional information.
The menu bar will only be hidden for the app that calls this method. The Dock will also be hidden at the same time.
(This is true at least in 10.9 and I have not tested any other versions.)
This is useful when you want to use an app in a full screen way where you have a cover window, a borderless window the size of the screen. The nice feature of this (as opposed to playing with LSUIElement settings) is that your app can continue to be in the application switcher cycling, as well as visible in the Dock when other apps are active. This allows users to still activate a full screen app through the Dock or application switcher. That means you can still use your app's Dock menu to access a preferences window for your app or other features. This is incredibly convenient if your app is indeed a full screen cover window that runs at a window level higher than other apps, but you still want to make preferences and the ability to quit your app available, and you want your app's visual functionality available when other apps are active.
2 Another option is via
NSApplication's methodsetPresentationOptions:with the arguments fromNSApplicationPresentationOptionsenum, such as optionNSApplicationPresentationHideMenuBarWith this approach be very wary of reading the documentation, although it gives you additional options, and is still app-specific only, you need to know that some of the options are mutually exclusive. There are rules you must follow, or you get nothing but exceptions spewed to the console.3 There is a 3rd and crappy option. If you have a helper app that is a daemon, you can use it to change your app's LSUIElement state and basically relaunch your app. It's dumb and it takes you out of the app switcher completely, which is great if you really are writing something that should not be there, but that is rare.