Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
Fix systemPreferences.getMediaAccessStatus is not a function on Linux (
Browse files Browse the repository at this point in the history
  • Loading branch information
quanglam2807 authored Sep 9, 2020
1 parent 81589a2 commit 085fe67
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/helpers/take-screenshot-to-blob-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ const takeScreenshotToBlob = () => {

// https://github.com/karaggeorge/mac-screen-capture-permissions/tree/master
// https://nyrra33.com/2019/07/23/open-preference-pane-programmatically/
const permissionStatus = remote.systemPreferences.getMediaAccessStatus('screen');
if (permissionStatus !== 'granted') {
if (window.process.platform === 'darwin') {
remote.shell.openExternal('x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture');
}
if (window.process.platform === 'darwin' && remote.systemPreferences.getMediaAccessStatus('screen') !== 'granted') {
remote.shell.openExternal('x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture');
return Promise.resolve();
}

Expand Down

0 comments on commit 085fe67

Please sign in to comment.