Skip to content

Instantly share code, notes, and snippets.

@chris-sev
Forked from jldeen/function.sh
Created May 25, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-sev/15f9947d7c980ba785a2813feb36e51a to your computer and use it in GitHub Desktop.
Save chris-sev/15f9947d7c980ba785a2813feb36e51a to your computer and use it in GitHub Desktop.
toggle mac menu bar
function toggleMenu () {
~/.dotfiles/bin/toggleMenuBigSur.sh
}
#!/usr/bin/env osascript
try
if application "System Preferences" is running then do shell script "killall 'System Preferences'"
end try
repeat until application "System Preferences" is not running
delay 0.1
end repeat
tell application "System Preferences"
reveal anchor "Main" of pane id "com.apple.preference.dock"
end tell
tell application "System Events" to tell application process "System Preferences"
repeat while not (exists of UI element "Automatically hide and show the menu bar" of window "Dock & Menu Bar")
delay 0.1
end repeat
click UI element "Automatically hide and show the menu bar" of window "Dock & Menu Bar"
repeat while not (exists of UI element "Automatically hide and show the menu bar" of window "Dock & Menu Bar")
delay 0.1
end repeat
end tell
try
if application "System Preferences" is running then do shell script "killall 'System Preferences'"
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment