小渔分享

小渔分享

youtube
bilibili
zhihu

How to Use iPad as the Main Screen for Mac mini【Wi-Fi Version】

Principle Analysis#

↓ Mind Map

Screenshot 2025-01-22 04.50.50

  • Explanation:
    • Here I made a sketch
    • Briefly explain the principle
    • The iPad and Mac mini need to be connected to the same Wi-Fi
    • The iPad uses the ssh command to find the Mac mini and run the script code to enable Sidecar
    • The Mac mini first checks if there are any available displays
    • Since there is no display, the iPad cannot enable the Sidecar feature
    • Therefore, we need to create a virtual screen to pass the Mac mini's self-check
    • This way, the Mac mini can transmit the video to the iPad

System Requirements to Enable Sidecar#

Screenshot 2025-03-06 08.02.52

Mac mini Operation Section#

↓ The operation steps for Mac mini M4 are as follows

  • Search → Automator → Click New Document → Select Application → Search AppleScript

    1. Copy the code into AppleScript
    2. Sidecar Code
      • Change “This is your iPad name” to the iPad name

      on findLastTargetIndex(targetItem, itemList)
      
      	set lastIndex to 0
      
      	repeat with i from (count of itemList) to 1 by -1
      
      		if item i of itemList is targetItem then
      
      			set lastIndex to i
      
      			exit repeat
      
      		end if
      
      	end repeat
      
      	return lastIndex
      
      end findLastTargetIndex
      
      beep 1
      beep 1
      
      tell application "System Settings"
      
      	activate
      	delay 1
      
      	tell application "System Events"
      		tell process "System Settings"
      		
      			-- Click the "Display" menu item in the menu bar
      			click menu item "显示器" of menu "显示" of menu bar item "显示" of menu bar 1
      
      			delay 0.3
      
      			tell group 1 of group 2 of splitter group 1 of group 1 of window "显示器"
      				try
      					-- The system settings need time to load the right interface after a cold start
      					delay 1
      					click pop up button "添加"
      
      					-- Get all menu item names in the "Add" menu
      
      					set menuItems to name of menu items of menu "添加" of pop up button "添加"
      
      					-- Find the index of the last matching item by name
      
      					set targetIndex to (my findLastTargetIndex("这里是自己iPad名称", menuItems))
      
      					-- Click the target menu item
      					delay 0.3
      					click menu item targetIndex of menu "添加" of pop up button "添加"
      
      					say "Sidecar is connected"
      
      				on error
      
      					delay 0.5
      
      					say "Not found"
      
      				end try
      
      			end tell
      
      		end tell
      
      	end tell
      
      end tell
      
      delay 1
      
      beep 1
      
      -- Optional: Exit System Settings
      
      -- tell application "System Settings" to quit
      
  • Save the code → Name it → Enable Sidecar

    • Permissions need to be enabled before running
      • System Settings → Privacy & Security → Accessibility → Turn on (Enable Sidecar, Automator)
  • Run the code and check if it works

iPad Operation Section#

↓ The operation steps for iPad 9 are as follows

  • Click → Shortcuts → Click Add → Click Search on the right → ssh → Select Run Script Over SSH
    • Check the host IP address, enter the command open -a Enable Sidecar, rename: Enable Sidecar, Add to Home Screen

FEDEEC13-955B-4313-8533-87F598262D97_4_5005_c

Screenshot 2025-01-22 07.15.41

  • Allow Accessibility Apps to Access Your Mac
    - There is a point to note here: Privacy & Security → Accessibility → Enable Sidecar (delete and re-add and enable)
    • System Settings → Search: Shortcuts → Click: Advanced → Turn on: Allow Running Scripts

Creating a Virtual Screen on MacOS#

🔔: When we unplug the display cable, we cannot enable the Sidecar feature.

🔔: We trick the MacOS system by creating a virtual screen.

  • Download the software Better Display
  • Create a virtual screen → Random selection
  • Set Better Display to launch at startup
  • Set the virtual screen to Manage Display

Effect Display#

  • Mac mini boots up, blindly types in the password, iPad enables Sidecar with one click
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.