-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add screenRecordingPermission
option
#96
Add screenRecordingPermission
option
#96
Conversation
See the feedback in #67. There should be an option for each check. |
index.d.ts
Outdated
|
||
Setting this to true will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property will always be set to an empty string. | ||
*/ | ||
disableScreenRecordingPermission: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disableScreenRecordingPermission: boolean; | |
screenRecordingPermission: boolean; |
index.d.ts
Outdated
/** | ||
Disable the screen recording permission check (macOS) | ||
|
||
Setting this to true will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property will always be set to an empty string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should mention the default value with @default
.
https://github.com/sindresorhus/typescript-definition-style-guide
readme.md
Outdated
|
||
## Options | ||
|
||
- `disableScreenRecordingPermission` *(boolean)* - Disable the screen recording permission check (macOS). Setting this to true will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property will always be set to an empty string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use formatting like https://github.com/sindresorhus/boxen#options
readme.md
Outdated
@@ -45,13 +45,17 @@ const activeWin = require('active-win'); | |||
|
|||
## API | |||
|
|||
### activeWin() | |||
### activeWin(options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### activeWin(options) | |
### activeWin(options?) |
@wrgoto Thanks for your contributions! |
@sindresorhus I agree there should be an option for each check, but I haven't verified the extent of removing the accessibility check. I'm not entirely sure if it is limited to the |
@sindresorhus are you looking to get this merged soon? |
index.test-d.ts
Outdated
@@ -4,7 +4,7 @@ import {Result, LinuxResult, MacOSResult, WindowsResult} from '.'; | |||
|
|||
expectType<Promise<Result | undefined>>(activeWin()); | |||
|
|||
const result = activeWin.sync(); | |||
const result = activeWin.sync({ screenRecordingPermission: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const result = activeWin.sync({ screenRecordingPermission: false }); | |
const result = activeWin.sync({screenRecordingPermission: false}); |
lib/macos.js
Outdated
|
||
const args = []; | ||
if (options.screenRecordingPermission === false) { | ||
args.push('--disable-screen-recording-permission'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.push('--disable-screen-recording-permission'); | |
args.push('--no-screen-recording-permission'); |
--no
is the convention for inverted flags.
readme.md
Outdated
Type: `boolean`\ | ||
Default: `true` | ||
|
||
Enable the screen recording permission check (macOS). Setting this to `false` will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable the screen recording permission check (macOS). Setting this to `false` will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. | |
Enable the screen recording permission check. Setting this to `false` will prevent the screen recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. |
readme.md
Outdated
|
||
## Result | ||
|
||
Returns a `Promise<Object>` with the result, or `Promise<undefined>` if there is no active window or if the information is not available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a `Promise<Object>` with the result, or `Promise<undefined>` if there is no active window or if the information is not available. | |
Returns a `Promise<object>` with the result, or `Promise<undefined>` if there is no active window or if the information is not available. |
readme.md
Outdated
|
||
Type: `object` | ||
|
||
##### screenRecordingPermission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
##### screenRecordingPermission | |
##### screenRecordingPermission **(macOS only)** |
readme.md
Outdated
|
||
### activeWin.sync() | ||
#### options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to document the options
twice.
index.d.ts
Outdated
@@ -1,4 +1,15 @@ | |||
declare namespace activeWin { | |||
interface Options { | |||
/** | |||
Enable the screen recording permission check (macOS). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable the screen recording permission check (macOS). | |
Enable the screen recording permission check. _(macOS)_ |
index.d.ts
Outdated
/** | ||
Enable the screen recording permission check (macOS). | ||
|
||
Setting this to `false` will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting this to `false` will prevent the Screen Recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. | |
Setting this to `false` will prevent the screen recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string. |
index.d.ts
Outdated
|
||
@default true | ||
*/ | ||
screenRecordingPermission: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screenRecordingPermission: boolean; | |
readonly screenRecordingPermission: boolean; |
The PR title needs to be updated. |
5c32311
to
e34d0ae
Compare
e34d0ae
to
1d1aa27
Compare
screenRecordingPermission
option
Why
One of the significant drawbacks is the library asking for Screen Recording permissions for macOS versions 10.15 and newer. Even though the library doesn't actually record the screen, it is required to get the title of the active window. For those who do not need the window title, there should be an option to forgo the Screen Recording permission check.
Changes
disableScreenRecordingPermission
option.Related