Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically 'auto hide menubar' in El capitan

I really love the 'auto hide menubar' option in El Capitan, but sometimes I like it (private) sometimes I don't (work). Is there a way to show/hide it programmatically by changed it's value in a plist file? If so, in which plist file is that setting found? Any help is appreciated.

like image 310
smelly586 Avatar asked Dec 15 '22 11:12

smelly586


2 Answers

As answered by Rich Trouton on apple.stackexchange.com

Here's how you can set the menubar to be hidden and unhidden using defaults:

To hide:

defaults write NSGlobalDomain _HIHideMenuBar -bool true

To show:

defaults write NSGlobalDomain _HIHideMenuBar -bool false

Once run, logout and log back in. Alternatively, you can run the following command as the logged-in user to restart Finder and show the changes:

killall Finder

MacOs Sierra

As trevordmiller points out in the comment below, in Sierra it seems you have to close your terminal first to make the change have any effect.

like image 104
smelly586 Avatar answered Jan 05 '23 17:01

smelly586


As of 10.12.5 I am finding that @trevordmiller is only partially correct; Every application seems to need to be individually restarted to register the new setting. In other words, If I use:

defaults write NSGlobalDomain _HIHideMenuBar -bool false
killall Finder

this only shows the menu bar while Finder is active. To show it in other apps, I have to restart them. Killall Finder is not required in any way other than that it restarts Finder app and registers the setting for it. Same for restarting any terminal app.

like image 30
Matt Groth Avatar answered Jan 05 '23 17:01

Matt Groth