From b7a20cd5e4beceefae133928b252a50d50451f23 Mon Sep 17 00:00:00 2001 From: gxalpha Date: Mon, 25 Jul 2022 19:53:57 +0200 Subject: [PATCH] UI: Add function to open privacy preferences on macOS --- UI/platform-osx.mm | 11 +++++++++++ UI/platform.hpp | 1 + 2 files changed, 12 insertions(+) diff --git a/UI/platform-osx.mm b/UI/platform-osx.mm index 1e2cc71e6..d3697314e 100644 --- a/UI/platform-osx.mm +++ b/UI/platform-osx.mm @@ -373,6 +373,17 @@ MacPermissionStatus CheckPermissionWithPrompt(MacPermissionType type, return permissionResponse; } +void OpenMacOSPrivacyPreferences(const char *tab) +{ + NSURL *url = [NSURL + URLWithString: + [NSString + stringWithFormat: + @"x-apple.systempreferences:com.apple.preference.security?Privacy_%s", + tab]]; + [[NSWorkspace sharedWorkspace] openURL:url]; +} + void TaskbarOverlayInit() {} void TaskbarOverlaySetStatus(TaskbarOverlayStatus status) { diff --git a/UI/platform.hpp b/UI/platform.hpp index a7ed1786c..3678e5298 100644 --- a/UI/platform.hpp +++ b/UI/platform.hpp @@ -105,4 +105,5 @@ MacPermissionStatus CheckPermissionWithPrompt(MacPermissionType type, bool prompt_for_permission); #define CheckPermission(x) CheckPermissionWithPrompt(x, false) #define RequestPermission(x) CheckPermissionWithPrompt(x, true) +void OpenMacOSPrivacyPreferences(const char *tab); #endif