Skip to content

Instantly share code, notes, and snippets.

@yangwao
Last active February 4, 2022 13:37
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 yangwao/7fb4fe87e30c67b24db9dc9c85d4911b to your computer and use it in GitHub Desktop.
Save yangwao/7fb4fe87e30c67b24db9dc9c85d4911b to your computer and use it in GitHub Desktop.
sidecar_monterey.app
### How to connect ipad as secondary display at Monterey
### Connect Side Car on Monterey
### Author https://twitter.com/yangwao
### https://github.com/yangwao
### Open script editor and save as app
### Don't forget to add permisions in privacy window to controll it
### Original Source https://www.reddit.com/r/MacOS/comments/il8x0y/is_it_possible_to_automatically_connect_to/g3tlhxc/
### Missing to check for accidental glitches if ipad is connected, but not showing display, yeah happen so something that would cycle would be warm welcome
### You need allow permission in Security & Privacy > Accessibility > your_script_name.app
tell application "System Preferences"
reveal pane id "com.apple.preference.displays"
delay 0.5
tell application "System Events" to click first pop up button of first window of application process "System Preferences" of application "System Events"
delay 0.5
tell application "System Events" to click second menu item of first menu of first pop up button of first window of application process "System Preferences" of application "System Events"
quit
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment