Last active
April 6, 2022 19:37
-
-
Save horothesun/0906ac016f2175e36a077eb7ec38ace7 to your computer and use it in GitHub Desktop.
Toggle Apple Sidecar display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Setup | |
# | |
# ln -sf `pwd`/toggle_sidecar.sh ~/bin/toggle_sidecar.sh | |
# Usage | |
# | |
# toggle_sidecar.sh | |
read -d '' TOGGLE_SIDECAR_APPLE_SCRIPT <<EOF | |
tell application "System Preferences" | |
activate | |
reveal pane id "com.apple.preference.displays" | |
delay 1 | |
tell application "System Events" to click first pop up button of first window of application process "System Preferences" | |
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" | |
quit | |
end tell | |
EOF | |
osascript -e "$TOGGLE_SIDECAR_APPLE_SCRIPT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment