Run Sidecar from iPad even while Mac is sleeping/locked or closed, affectively allowing Sidecar to be used In headless mode.
Please make sure to enable remote login under sharing in system preferences.
To access your Macs IP address click on sharing again in system preferences. At the top it should say your Mac is accessible at name-MacBook-Pro.local or something similar. Copy paste this into the shortcut Mac IP import question.
If you will be running this shortcut while computer is locked or closed, Make sure power nap is enabled under power save settings and plugged in.
Please note this shortcut can take up to 6 seconds to complete be patient before running again. If Shortcut is run while Mac is already connected, Mac will be disconnected and sent to sleep mode.
More reliable connection