Last active
June 30, 2024 12:58
-
-
Save dagronf/c1fd2635c99c627bcfb2e7abb3c31a90 to your computer and use it in GitHub Desktop.
macOS: Open system preferences at a specified pane using Swift (or Objective-C) using x-apple.systempreferences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Applescript: tell application "System Preferences" to get anchors of current pane | |
// Result: | |
// { anchor "Privacy_Reminders" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_SystemServices" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_Calendars" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Firewall" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_Assistive" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_LinkedIn" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_Accessibility" of pane id "com.apple.preference.security" of application "System Preferences", | |
// anchor "Privacy_Contacts" of pane id "com.apple.preference.security" of application "System Preferences", | |
// ... | |
let prefsURL = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility")! | |
NSWorkspace.shared.open(prefsURL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment