Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid triggering access dialogs on macOS #67

Closed
wants to merge 2 commits into from

Conversation

drslump
Copy link

@drslump drslump commented Apr 2, 2020

Recent macOS versions the operating system is triggering accessibility dialogs asking the user if an operation should be allowed. Our application tries to guide the user through it as part of our onboarding setup.

So it'll be great if we can instruct active-win to skip functionality that would trigger those dialogs. For instance we already ask for the Screen Recording permission that provides the title, hence we shouldn't need the Accessibility one or inspect Chrome for the url since we don't require that information.

These changes allow to pass the following options:

  • accessCheck: false -- disables the accessibility checks and so the OS prompts
  • appleScript: false -- disables the use of apple script (used to obtain the URL only)

Hopefully this is something most people will find useful. And thanks for the library!

@sindresorhus
Copy link
Owner

Sounds useful, but it needs to be documented in the readme and index.d.ts.

lib/macos.js Outdated Show resolved Hide resolved
lib/macos.js Outdated Show resolved Hide resolved
@@ -1,4 +1,21 @@
declare namespace activeWin {
interface Options {
/**
Disable Accessibility permission check (macOS)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs text should be in sync with the readme text.

I think each option should also describe what the effect of disabling it is, for example, the window title not being available.

/**
Disable Accessibility permission check (macOS)
*/
accessibilityCheck: boolean;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
accessibilityCheck: boolean;
readonly accessibilityCheck: boolean;

const result = activeWin.sync({
accessibilityCheck: false,
screenRecordingCheck: false,
url: false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: false,
url: false

@@ -2,9 +2,14 @@ import {expectType, expectError} from 'tsd';
import activeWin = require('.');
import {Result, LinuxResult, MacOSResult, WindowsResult} from '.';


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -47,11 +47,17 @@ const activeWin = require('active-win');

### activeWin()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### activeWin()
### activeWin(options?)

@sindresorhus
Copy link
Owner

@drslump Friendly bump :)

@sindresorhus
Copy link
Owner

@drslump Bump

@achuinard
Copy link

@sindresorhus Why would you just close this PR and leave the issue open? It looks like it was a good work in progress. Wouldn't it make sense to touch up the PR in the ways you recommend and merge this in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants