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

Give more context on screen recording #31

Closed
denisidoro opened this issue Mar 31, 2020 · 9 comments
Closed

Give more context on screen recording #31

denisidoro opened this issue Mar 31, 2020 · 9 comments

Comments

@denisidoro
Copy link

Hi! Thanks for the project.

Could you please give more context on why screen recording is necessary or when it is used?

I'd love to give this workflow a try but, given that I deal with some sensitive data at work, enabling this permission is a red-flag for me at the moment.

@mandrigin
Copy link
Owner

Hey! Thanks for your interest!
Starting Catalina, it it impossible to get a window title w/o this permission.
The workflow never actually records anything, but it asks for that if it doesn’t see the window name.

You can take a look at this method here: https://github.com/mandrigin/AlfredSwitchWindows/blob/master/EnumWindows/main.swift#L45 and everything it calls.

That’s the Apple presentation about it: https://devstreaming-cdn.apple.com/videos/wwdc/2019/701ngx868rfo8jlj/701/701_advances_in_macos_security.pdf?dl=1

You can search by kCGWindowName that this workflow uses.

@mandrigin
Copy link
Owner

Also, you will need to give the screen recording permission to Alfred, which is more risky than just giving it to EnumWindows, that is open source. So maybe (I didn't try that myself), it would be better to go to your workflows, find Swift Window Switcher, open it in Finder, find the executable called EnumWindows and add it to the screen recording permissions.

@v-braun
Copy link

v-braun commented Apr 30, 2020

How I can add it to the Screen Recording Permission list?
There is no add button and as I understood it the app has to ask for this permission to be listed in this list!?

@mandrigin
Copy link
Owner

@v-braun on the first use it will ask for this permission. After you install the app, just type w safari in your Alfred and you should see the dialog. If it isn't shown, most probably Alfred is already there but the checkbox isn't set. Just go to System Preferences -> Security and Privacy -> Privacy -> Screen Recording and set the checkbox there.

@v-braun
Copy link

v-braun commented May 2, 2020

It is really really strange!
It was not there but I had to restart my Mac yesterday and now it appears there 😅
Maybe it was there but I could not see it!
Anyhow: thank you a lot for this awesome tool.
The performance could be a bit better, it takes a while till the windows are listed, but I checked yr code and don't see where to optimize, looks like it is the apple API that is there the bottleneck!

@mandrigin
Copy link
Owner

It looks like these APIs are slower in Catalina. I’m thinking about making windows/tabs enumeration parallel and see how it helps. Instruments show mostly that performSelector is on the hot path.

It’s getting a bit annoying because being quick was one of the points of this workflow in the first place.

When I have a bit more free time, I will try to experiment a bit more.

@v-braun
Copy link

v-braun commented May 4, 2020

I had once another idea for the same problem:
what if you would have a dedicated service running in background and monitor all the windows on your mac.
This service can expose an API (REST or even Socket for performance) that other Apps can consume.
But you are free there to use caching or listening to system events.

This would end in much better performance and open this awesome tool for much more than a "simple" Alfred Window switching workflow.
It is possible to use it within a workflow, a standalone app or integrate it into CLI apps (for example automated UI testing, etc.)

@mandrigin
Copy link
Owner

I'm afraid it will have some negative privacy implications. The OS should just handle it faster :)

@v-braun
Copy link

v-braun commented May 4, 2020

... or the OS should handle it faster 😂

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

No branches or pull requests

3 participants