0

I'm trying to programmatically (shell) control MacOS auto-hide feature of menu bar, but could not find working solution.

For controlling manu bar auto-hide on regular desktop I can use AppleScript similar to this:

tell application "System Events"
  set autohide menu bar of dock preferences to true
end tell

To control full screen window I found that there is AppleMenuBarVisibleInFullscreen from -globalDomain.

defaults read -globalDomain AppleMenuBarVisibleInFullscreen

This setting is changing indeed by system preferences application, but changing it with CLI does not work at all. Menu bar in fullscreen application does not seem to be affected at all. I tried like that:

defaults write -globalDomain AppleMenuBarVisibleInFullscreen -bool true

Am I missing some preference refresh call or changing wrong property? I would like to avoid clicking through system preferences using AppleScript.

krzychek
  • 300
  • 3
  • 9
  • I don't recall the details but I've seen several Q/A here (and maybe on ask different) that advise the killing of some process in order to make such changes happen. – Mockman Jul 26 '23 at 00:33
  • As @Mockman intimated, it's almost always necessary to kill and relaunch the relevant process for new `defaults` to take effect. `defaults` only makes amendments to preferences files, but the program won't generally be aware the file has changed until it next has cause to read from it (e.g. when launching). In this situation, the application to kill would be the Dock (e.g. `pkill com.apple.dock`). – CJK Jul 26 '23 at 16:51
  • Killing com.apple.dock does not seem to work. Maybe I can debug somehow what macos setting tools is doing underhood? – krzychek Jul 29 '23 at 15:09

0 Answers0