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

Screen recording permission requested even when window animation disabled #2378

Closed
cpick opened this issue Aug 4, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@cpick
Copy link

cpick commented Aug 4, 2024

Running yabai with the example version of yabairc prompts for "Screen & System Audio Recording" permission. When that's denied it prints the warning:

command 'window_animation_duration' for domain 'config' requires Screen Recording permissions! ignoring request..

The README.md says:

yabai must be given Screen Recording permission if and only if you want to enable window animations, and will request access when necessary

And the yabairc (linked above) includes:

yabai -m config                                 \
...
    window_animation_duration    0.0            \
    window_animation_easing      ease_out_circ  \

The man page says:

window_animation_duration [<FLOAT_SEL>]
Duration of window frame animation.
If 0.0, the change in dimension is not animated.

So I would have thought that window animation was disabled (by being set to 0.0) and that that would case the permission to not be requested?

@cpick
Copy link
Author

cpick commented Aug 4, 2024

I'm guessing that at this point:

        } else if (token_equals(command, COMMAND_CONFIG_ANIMATION_DURATION)) {
            struct token_value value = token_to_value(get_token(&message));
            if (value.type == TOKEN_TYPE_INVALID) {
                fprintf(rsp, "%f\n", g_window_manager.window_animation_duration);
            } else if (value.type == TOKEN_TYPE_FLOAT) {
                if (CGPreflightScreenCaptureAccess()) {

There should be an additional if (value.float_value) around the if (CGPreflightScreenCaptureAccess()) { ... } else { ... } so permissions are checked if and only if value.float_value != 0.0?

@cpick
Copy link
Author

cpick commented Aug 4, 2024

That seems to do the trick, opened #2379

koekeishiya added a commit that referenced this issue Aug 4, 2024
koekeishiya added a commit that referenced this issue Aug 4, 2024
@koekeishiya koekeishiya added bug Something isn't working addressed on master; not released Fixed upstream, but not yet released labels Aug 4, 2024
@koekeishiya
Copy link
Owner

Fixed in 4572d69 14f1220

@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants