Skip to content

Instantly share code, notes, and snippets.

@jldeen
Created October 15, 2020 19:37
Show Gist options
  • Save jldeen/5f070004d1f02825900aa0bb7aa5e6e6 to your computer and use it in GitHub Desktop.
Save jldeen/5f070004d1f02825900aa0bb7aa5e6e6 to your computer and use it in GitHub Desktop.
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
@BrianAMartin221
Copy link

Ugh bummer you did all the work to get it working. Glad I've only updated my personal machine and not my work ones yet.

I'll fiddle around with it today as well and if I get it working I'll reply here.

@jldeen
Copy link
Author

jldeen commented Nov 18, 2020

@BrianAMartin221 - Just checking in. Sadly, I don't have an update yet, but I do know what is causing the problem. I recorded a video of what's happening from an accessibility / UI perspective and just have to either script around it, or wait for a fix from apple. You can see the video here.

You and a few others have now reached out about this bug. Several people have some innovative workarounds that are discussed here.

I will keep checking back as I investigate this, or once Apple releases a fix.

@BrianAMartin221
Copy link

I set a reminder to comment here! I am one of the posters on that KM post. Thanks for the reply. Hopefully, this gets addressed in 11.1. I liked having sys pref. staying in the backround.

@gabrielbacha
Copy link

Ah perfect. Just what I was looking for. Exactly the same issue for me. Used to work in Catalina (under General), and now I get the same error "Can't Get Anchor "Main" of pane id "com.apple.preference.dock".

I'll keep an eye here to see when it gets resolved!

Thanks for this

@gabrielbacha
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment