bvanpeski / unActivationLock

A tool for ensuring user-based activation lock remains off.
Apache License 2.0
64 stars 6 forks source link

Ventura Command for System Setting #2

Closed kspitzer14 closed 1 year ago

kspitzer14 commented 1 year ago

I spent a ton of time beating my head against this same issue while building my own version of this project. The command to get you to where you need to be in Ventura is

open "x-apple.systempreferences:com.apple.preferences.AppleIDPrefPane?iCloud"

Awesome project!

bvanpeski commented 1 year ago

No way! I wonder how long that will work... open "x-apple.systempreferences:com.apple.preferences.AppleIDPrefPane" is the old Monterey command that's still respected by Ventura, but I wouldn't be surprised if that gets deprecated in favor of the new Ventura extension open x-apple.systempreferences:com.apple.systempreferences.AppleIDSettings. But hey, this sure beats the whacky Applescript GUI automation I have for v2! Might just swap that out for this instead. Thanks!

kspitzer14 commented 1 year ago

I'm sure it will remain for the life of Ventura, but you're right, I suspect that macOS 14 will re-arrange things for us.

bvanpeski commented 1 year ago

Agreed. I'll incorporate this into the next revision of the script. thanks! If macOS 14 breaks that URL (and Apple hasn't provided an alternative to open Apple ID in System Settings), I'll leave my GUI-scripting notes below so I can reference them later in case I need them.

# Requirements: PPPC Profile to grant the MDM agent access to Accessibility.

# Variables
osVer="$(sw_vers -productVersion)"

MDMBundleID="io.kandji.KandjiAgent" #Used to confirm the MDM agent has access to Accessibility for more fine-tuned System Settings control. You have to deploy that PPPC profile separately. (optional)

pppc_status=$(/usr/libexec/PlistBuddy -c 'print "'$MDMBundleID':kTCCServiceAccessibility:Allowed"' "/Library/Application Support/com.apple.TCC/MDMOverrides.plist")

# Functions
SettingsNav (){
#Checks if Accessibility access is approved for the MDM Agent and if so, uses Applescript to navigate directly to the iCloud section of the Apple ID Settings window in Ventura.
  if [[ $osVer > 14.* && $pppc_status = true ]]; then
    open x-apple.systempreferences:com.apple.systempreferences.AppleIDSettings
    sleep 2
    /usr/bin/osascript -e 'tell application "System Events" to tell its application process "System Settings" to click UI element 1 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1'
  elif [[ $osVer > 14.* ]]; then
    open x-apple.systempreferences:com.apple.systempreferences.AppleIDSettings
  else
    open "x-apple.systempreferences:com.apple.preferences.AppleIDPrefPane?iCloud"
  fi  
}
bvanpeski commented 1 year ago

Updated in https://github.com/bvanpeski/unActivationLock/pull/4