Skip to content

Instantly share code, notes, and snippets.

@yangwao
Created December 7, 2021 19:44
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/a0fae9fc467493f65c411667576b3b0e to your computer and use it in GitHub Desktop.
Save yangwao/a0fae9fc467493f65c411667576b3b0e to your computer and use it in GitHub Desktop.
20:44:20 ❯ cat useforce.sh
#!/bin/bash
osascript sidecar.scpt
~
20:44:22 ❯ cat sidecar.scpt
#!/usr/bin/env osascript
set controlCenterName to "Control Centre"
set connectToSidecarName to "Connect to Sidecar"
set iPadName to "Magnetic tunnel"
tell application "System Events"
tell application process "ControlCenter"
set controlCenterIcon to (menu bar item controlCenterName of menu bar 1)
click controlCenterIcon
if not exists (window controlCenterName)
click controlCenterIcon
end if
delay 0.6
tell group 1 of group 1 of window controlCenterName
click checkbox connectToSidecarName
delay 0.6
click checkbox iPadName
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment