My own answer at https://apple.stackexchange.com/a/436069/53510 does not work for me now that my MacBook Pro has 12.6, and neither does this answer: https://apple.stackexchange.com/a/448556/53510
What do I need to update to get it to work again?
I want to easily toggle between "Default" and "More Space" shown here:
To have a single keyboard shortcut that toggles between 2 resolutions:
- Automator > File > New > Quick Action > Choose
- Search for "Run AppleScript" and double-click the result.
- Replace the default script code with what I provide below.
- Try clicking the Run button a couple times to see if the toggling works.
- Save as "toggle_display_resolution". (Later, if you ever want to edit it, you'll open
/Users/your_username/Library/Services/toggle_display_resolution.workflow
in Automator). - Close Automator.
- System Preferences > Keyboard > Shortcuts > Services
- Assign a keyboard shortcut to the new service that you created (which will probably be at the bottom of the list).
By the way, you may need to edit your "Security & Privacy" > Accessibility. See answer.
# https://apple.stackexchange.com/q/449891/53510
set monitor to 2
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
delay 2
tell application "System Events"
tell window "Displays" of application process "System Preferences"
click button "Display Settings…"
delay 2
click row monitor of outline 1 of scroll area 1 of sheet 1
click radio button "Scaled" of radio group 1 of sheet 1
tell sheet 1
# ----------------------------------
# from "try" to "end try" is the problem:
try
set selected_button to button "Resolution4, Selected"
click button "Resolution1"
on error
click button "Resolution4"
end try
# ----------------------------------
end tell
delay 0.5
click button "Done" of sheet 1
end tell
end tell
end tell
# The next line is optional and could be commented out by prepending with a hash (#).
delay 2
quit application "System Preferences"
I don't know how to specify the Object Specifier for buttons Resolution1 and Resolution4.
I tried adding "in collection 1" because the Accessibility Inspector says that the container's type is "collection" (see screenshot below), but that didn't work.