Skip to content

Instantly share code, notes, and snippets.

@th507
Created October 8, 2021 07:16
Show Gist options
  • Save th507/5370694254ae742733f47ba96404154b to your computer and use it in GitHub Desktop.
Save th507/5370694254ae742733f47ba96404154b to your computer and use it in GitHub Desktop.
Toggle macOS menubar (compatible w/ earlier versions of macOS)
set os_version to system version of (system info)
if os_version as string < "11.0" then
#display dialog "Smaller than 11"
tell application "System Preferences"
activate
reveal pane id "com.apple.preference.general"
end tell
delay 0.5
tell application "System Events"
tell window "General" of process "System Preferences"
click checkbox "Automatically hide and show the menu bar"
end tell
end tell
tell application "System Preferences" to quit
else
#display dialog "Larger than 11"
# following script adopted from https://jessicadeen.com/show-hide-menubar-big-sur/
tell application "System Events"
set menu_status to autohide menu bar of (dock preferences)
tell dock preferences to set autohide menu bar to not menu_status
#tell dock preferences to set autohide menu bar to not autohide menu bar
end tell
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment