Coder Social home page Coder Social logo

Comments (5)

Srini-B avatar Srini-B commented on June 19, 2024 2

Not an elegant way, but I achieved it using another package
macos-accessibility-permissions
mac-screen-capture-permissions

from node-mac-permissions.

codebytere avatar codebytere commented on June 19, 2024 1

@Srini-B @theogravity does #60 address your issue?

Unfortunately the ergonomics aren't great for forcing the pref pane since it's kind of impossible to check in a clean way whether access has been denied previously or not yet queried, so i ended up adding a bool param to the request method. If that serves both of your needs well i can go ahead and merge it!

from node-mac-permissions.

notedit avatar notedit commented on June 19, 2024

Same here, @Srini-B any ideas?

from node-mac-permissions.

theogravity avatar theogravity commented on June 19, 2024

I didn't have any success with those recommended packages on the latest electron version 23 and MacOS Ventura.

I was able to get the pane to open by using the following:

import { execSync } from 'child_process';
import { isMacOSVersionGreaterThanOrEqualTo } from 'macos-version';
import { systemPreferences } from 'electron';
import { askForScreenCaptureAccess } from 'node-mac-permissions';

// initial prompt
askForScreenCaptureAccess();
const status = systemPreferences.getMediaAccessStatus('screen');

// user denied prompt, open up the pane for them to do it then
if (status === 'denied' && isMacOSVersionGreaterThanOrEqualTo('10.16')) {
  try {
    execSync('open "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"');
  } catch (e) {
    console.log(e)
  }
}

from node-mac-permissions.

theogravity avatar theogravity commented on June 19, 2024

Actually it's how one of the other packages does it too. I'm ok with that! Thanks for that PR!

from node-mac-permissions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.