nashaofu / xcap

XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented).
https://docs.rs/xcap
Apache License 2.0
459 stars 55 forks source link

MacOS screencapture not working properly? #123

Closed shirshak55 closed 3 months ago

shirshak55 commented 4 months ago

It only shows background window. Brave is running, but I don't why it isn't capturing it.

image
nashaofu commented 4 months ago

Do you have screenshot permission for your application? Without screenshot permission, you can only take screenshots of the desktop

shirshak55 commented 4 months ago

Yes. I have given permission. However, it keeps asking permission

On Mon, Apr 22, 2024 at 10:45 PM nashaofu @.***> wrote:

Do you have screenshot permission for your application? Without screenshot permission, you can only take screenshots of the desktop

— Reply to this email directly, view it on GitHub https://github.com/nashaofu/xcap/issues/123#issuecomment-2071308131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5Y4YJ5ZZKOS7DUELPWL5DY6XDMRAVCNFSM6AAAAABGSEHTHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZRGMYDQMJTGE . You are receiving this because you authored the thread.Message ID: @.***>

ambethia commented 4 months ago

Same issue here on macos. I have also granted permission to the application.

Edit: scratch that. I was launching the app through VS code, and VS Code had not been granted permission. Upon doing that, the screenshots worked as expected.

codesoda commented 3 months ago

@shirshak55 Did the solution mentioned above work for you?

shirshak55 commented 3 months ago

@codesoda no, I am not running from visual studio code. I am running inside desktop app via tauri. If I run it from terminal it works, but when I run it as desktop app it doesn't.

nashaofu commented 3 months ago

https://github.com/nashaofu/tauri-xcap-demo I am able to take screenshots normally and command an authorization prompt to pop up once @shirshak55 @codesoda

nashaofu commented 3 months ago

https://github.com/nashaofu/xcap/assets/19303058/cdaa788e-9587-4836-a913-34c75ef26b4d

shirshak55 commented 3 months ago

@nashaofu

Today I ran same old rust code and I am not facing the issue. I think macos updates fixed something or something happened without changing the code.

shirshak55 commented 3 months ago

@nashaofu

Ok, I think it is because of github action. If you built using github action, can u check if it works flawlessly?

nashaofu commented 3 months ago

https://github.com/nashaofu/tauri-xcap-demo/releases/tag/app-v0.0.0. Can you give it a try? I'm working normally here

shirshak55 commented 3 months ago

@nashaofu ok found the issue. While developing I gave permission to app. And when I downloaded the app it didn't ask me for permission. However, I manually removed the app and added new app permission and it worked.

I think app should reask for permission in such case instead of capturing broken screen.

Thanks.