Skip to content

Commit

Permalink
Add ability to open Screen Recording privacy settings on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jun 8, 2021
1 parent 43e1086 commit 846282f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/platform/mac/base_info_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ inline QString GetLibcVersion() { return QString(); }
inline QString GetWindowManager() { return QString(); }

void OpenInputMonitoringPrivacySettings();
void OpenDesktopCapturePrivacySettings();
void OpenAccessibilityPrivacySettings();

} // namespace Platform
7 changes: 7 additions & 0 deletions base/platform/mac/base_info_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ void OpenInputMonitoringPrivacySettings() {
[[NSWorkspace sharedWorkspace] openURL:PrivacySettingsUrl("Privacy_ListenEvent")];
}

void OpenDesktopCapturePrivacySettings() {
if (@available(macOS 10.15, *)) {
CGRequestScreenCaptureAccess();
}
[[NSWorkspace sharedWorkspace] openURL:PrivacySettingsUrl("Privacy_ScreenCapture")];
}

void OpenAccessibilityPrivacySettings() {
NSDictionary *const options=@{(__bridge NSString *)kAXTrustedCheckOptionPrompt: @TRUE};
AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)options);
Expand Down

0 comments on commit 846282f

Please sign in to comment.