Sidecar with easy setup

Hello together! So, based on @mikelxc great Sidecar Toggle I made one with an easy setup.
Hold it to enter the name of your iPad and you're free to go, nothing needs to be changed in the code itself.
No design changes.



Holding the button brings up the Setup window.

:arrow_down: Download the Widget
:arrow_down: Download the Setup Trigger

Sweet!

@Caliguvara @mikelxc

Whoa how did this slip past me...

I've been looking to include exactly this for the users of my AquaTouch Preset, would you mind if I intergrated this into it?

Credits in the code, changelog, and thankyou on the preset page!

It'll be a big help especially since I don't have an iPad i can test this with to code it myself

Sure!
I made some design changes since this version, tell me what you prefer :man_shrugging:t4:


1 Like

Naturally! Iā€™m a huge fan of your aquatouch

1 Like

@Caliguvara
It seems like the preset isn't working (returns "cannot find any iPads to connect to" error message). This is despite me connecting to the iPad using Sidecar numerous times. Any ideas why? Thanks

Maybe hold the widget to reset it?
Also, is the Screen Icon available und the Menu Bar?
And does the iPad appear in it?

Spent several hours fighting with Monterey to get access to "Control Center" window contents.
Which (for me at least) is returned as {}... the first time I try to access it.
After that weird quirk, it behaves as it should. Or so it seems.
I'm sure the next macOS patch release will obliterate the utility of this script.
Enjoy while you can~

-- BTT Sidecar Widget Setup 
-- AppleScript gymnastics for macOS Moneterey 12.01

tell application "BetterTouchTool"
	try
		set LclOldiPadName to get_string_variable "iPadWg_DevceName"
	on error
		set LclOldiPadName to "iPad"
	end try
end tell

tell application "System Events"
	tell its application process "ControlCenter"
		try
			-- changes names: "Display", "Display, Sidecar On"
			click (the first menu bar item of menu bar 1 whose title contains "Display")
			tell its window "Control Center"
				 -- initial READ is somehow required to actually access contents
				set empty_obj to entire contents
				click checkbox LclOldiPadName of scroll area 1
			end tell
			click (the first menu bar item of menu bar 1 whose title contains "Display")
		on error
			display dialog "Cannot find any iPads available right now"
		end try
	end tell
end tell

This is correct and applies to all windows of the Control Center.
See here: Catalina Sidecar toggle - #26 by Dirk