MacOS – Make the Menu Bar never show while in Full Screen

fullscreenmacosmenu bar

Pretty much every application I use in full-screen (including Firefox, MacVim and the Terminal) have tabs on the top of the screen.

The problem is, when I move my mouse to reach the tabs I'll often accidentally touch the top of the screen, bringing in the OS menu OVER the tabs:

Illustration - moving mouse to top of screen in fullscreen apps makes menu bar appear

Is there any way to change this behavior? I'd prefer it if the menu bar would stay hidden when I'm using a full-screen app, even if my mouse does touch the top of the screen.

Best Answer

  • Save the following AppleScript to a file named fullscreen.scpt:

    use framework "AppKit"
    use scripting additions
    
    repeat with runningApp in current application's NSWorkspace's sharedWorkspace's runningApplications()
        if runningApp's isActive()
            set frontApp to (localizedName of runningApp) as text
            exit repeat
        end if
    end repeat
    
    tell application "System Events"
        tell process frontApp to set isFullScreen to value of attribute "AXFullScreen" of first window
        if frontApp = "Finder"
            tell process frontApp to set value of attribute "AXFullScreen" of first window to not isFullScreen
        else if isFullScreen
            do shell script "lsappinfo setinfo -app " & quoted form of frontApp & " ApplicationType=Foreground"
            tell process frontApp to set value of attribute "AXFullScreen" of first window to false
    
            (*fix to make sure the menu bar is not stuck*)
            delay 0.42
            tell application "Finder" to activate
            tell process frontApp to set frontmost to true
        else
            do shell script "lsappinfo setinfo -app " & quoted form of frontApp & " ApplicationType=UIElement"
            tell process frontApp to set value of attribute "AXFullScreen" of first window to true
        end if
    end tell
    
  • From terminal, compile it to an application with the following command:

    osacompile -o "/Applications/Full Screen.app" fullscreen.scpt
    
  • Open the Full Screen.app's Info.plist (e.g. vim '/Applications/Full Screen.app/Contents/Info.plist') and add the following to the dict:

        <key>NSUIElement</key>
        <true/>
    
  • Add Full Screen.app as an exception in System Preferences > Security & Privacy > Privacy > Accessibility.

  • Launch Automator and create a new Service.

  • Change "Service receives" to "no input in any application".
  • Add a Library > Utilities > Launch Application action.
  • Configure the action to launch the previously created Full Screen application.
  • Save the service as Full Screen and close Automator.
  • On System Preferences > Keyboard > Shortcuts > Services, scroll down to the bottom of the list and the just created Full Screen service should be listed there. Associate an unique Command shortcut for it, like Shift+Command+\ or Command+F11 for example.

This creates a shortcut to cause an application to enter full screen while removing the menu bar, or to exit full screen bringing the menu bar back. It provides an alternative full screen shortcut!

For application-specific full screen launchers, check my other answer.

Caveats

There may be some disadvantages and/or misbehavior using this approach:

  • It works by setting ApplicationType=UIElement, which causes the application icon not be added/highlighted in the Dock and make the application inaccessible via Command+Tab. The Command+Tab issue was reported in comments, I didn't notice it since I mostly use the Mission Control overview to change between full screen applications.
  • It may not behave as expected for some specific applications, I've noticed issues with the Activity Monitor application (which is generally not used full screen anyway) and there's a report on Chrome, which I didn't try since I use Firefox and it works great.