Give more context on screen recording

#31 · closed · 9 comments

View on GitHub ↗

denisidoro

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.

Comments

mandrigin

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

Also, you will need to give the screen recording permission to Alfred, which is more risky than just giving it to `EnumWindow`s, 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

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

@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

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

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

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

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

v-braun

... or the OS should handle it faster 😂