Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
macosVersion.assertGreaterThanOrEqualTo("10.10");
const child = execFile(
"/usr/bin/osascript",
["-l", "JavaScript"],
{
env: {
OSA_ARGS: JSON.stringify(args)
},
maxBuffer: DEFAULT_MAX_BUFFER
},
(err: Error, stdout: any, stderr: any) => {
if (err) {
return reject(err);
}
if (stderr) {
console.error(stderr);
#!/usr/bin/env node
'use strict';
const path = require('path');
const meow = require('meow');
const execa = require('execa');
const macosVersion = require('macos-version');
macosVersion.assertGreaterThanOrEqualTo('10.14');
meow(`
Example
$ touch-bar
`);
const appPath = path.resolve(__dirname, 'vendor/Touch Bar Simulator.app');
execa('open', ['-a', appPath]);
module.exports = async (input, arguments_) => {
macosVersion.assertGreaterThanOrEqualTo('10.10');
const {stderr} = await execa('osascript', commandArguments, prepareOptions(input, arguments_));
return handleOutput(stderr);
};
module.exports = async () => {
macosVersion.assertGreaterThanOrEqualTo('10.11');
return (await execa.stdout(bin)) === 'true';
};
'use strict';
const path = require('path');
const fs = require('fs');
const execa = require('execa');
const {isElectron, fixPathForAsarUnpack} = require('electron-util/node');
const macosVersion = require('macos-version');
const binary = path.join(fixPathForAsarUnpack(__dirname), 'screen-capture-permissions');
const permissionExists = macosVersion.isGreaterThanOrEqualTo('10.15');
let filePath;
if (isElectron) {
const {api, openSystemPreferences} = require('electron-util');
exports.openSystemPreferences = () => openSystemPreferences('security', 'Privacy_ScreenCapture');
filePath = api.app && path.join(api.app.getPath('userData'), '.has-app-requested-screen-capture-permissions');
}
exports.hasScreenCapturePermission = () => {
if (!permissionExists) {
return true;
}