Catalina Sidecar toggle

Guys, some major updates today. It's now language independent, and will select your iPad by default. No need to input your iPad name.

tell application "System Events"
	tell process "ControlCenter"
		try
			perform action "AXPress" of menu bar item "Control Center" of menu bar 1
		on error
			display dialog "Please make sure you are using macOS Big Sur and have Control Center showing on your menu bar"
		end try
		try
			tell checkbox 6 of group 1 of group 1 of window 1
				perform action "AXPress"
			end tell
			delay 1
		on error
			display dialog "Cannot find Displays in your control center"
		end try
		try
			tell checkbox 4 of group 1 of group 1 of window 1
				perform action "AXPress"
			end tell
		on error
			display dialog "Cannot find your ipad"
		end try
	end tell
end tell

For those are also using Alfred, this is my preset

1 Like