ejbills / DockDoor

Window peeking for macOS
MIT License
295 stars 8 forks source link

Dock previews not available for apps running in another Space #9

Open stevehoek opened 1 week ago

stevehoek commented 1 week ago

Many similar Dock preview apps run into this problem. Apparently apps like DockView and DockMate use a Private API to get the window preview for running windows in other Spaces (not the current Space).

Could you look into this? Having only some windows show their Preview takes away from the mission of a Dock preview app.

hasansultan92 commented 1 week ago

+1 AltTab is able to solve this issue and I would want to see this functioning in DockDoor too

ejbills commented 1 week ago

Do you have any info on this private API?

stevehoek commented 1 week ago

Do you have any info on this private API?

Unfortunately no. There was another thread in r/macapps from someone who is building a dock preview app and he informed me that DockView and DockMate use it and that he refused to. If it can't show me all apps, I'll stick with the buggy DockView that is slightly less buggy than DockMate

ejbills commented 1 week ago

Ok

hasansultan92 commented 1 week ago

Can we perhaps reach out to the team at AltTab? I have been using that for years and they have it figured out. Seems to me that they have the GPL 3.0 license which my understanding is that we are allowed to copy and distribute but not change the codebase without permission. Seems to me that we can go over their codebase to understand how they sorted it potentially.

I could potentially look at this later in the week if this is still not taken up by someone

stevehoek commented 1 week ago

AltTab is open source: https://github.com/lwouis/alt-tab-macos

hasansultan92 commented 1 week ago

Right, so would it be that bad of an idea if we inspect how they did it since we don't have access to the aforementioned private APIs?

ShlomoCode commented 1 week ago

Do you have any info on this private API?

from https://alt-tab-macos.netlify.app/contributing:

OS APIs are quite limited for the kind of low-level, system-wide app AltTab is. This means often we just don’t have an API to do something. For instance, there is no API to ask the OS “how many Spaces does the user have?” or “Can you focus the window on Space 2?”. There are however, retro-engineered private APIs which you can call. These are not documented at all, not guaranteed to be there in future macOS releases, and prevent us from releasing AltTab on the Mac AppStore. We have tried my best to document the ones we are using, as well as ones we investigated in the past.

stevehoek commented 3 days ago

FWIW, another tool I've been watching just implemented multiple-spaces support, as well as full screen windows and iOS/iPad-app on Apple Silicon windows. Does not show the "screen recording" menu bar icon so I don't think it is using the private API.

https://wins.cool/

ejbills commented 3 days ago

Interesting, I'm curious how they are achieving that. I'm already half-using the new screencapturekit API, but in my testing it was limited to the current desktop space. I will download the developer beta and will try it out again.

ShlomoCode commented 3 days ago

It just means that it uses the cache at the expense of freshness, while alt-tab performs a background update. DockDoor now uses a cache with a minute expiration (which is a lot! in fact, too much) and no background refresh, so it's unlikely to have the "screen recording" icon like alt-tab-macos From my testing, the icon appears when many screenshots are taken in a row. If I uncache the screenshots in the current DockDoor code, and quickly hover back and forth over an icon in the Dock, the purple icon appears:

CleanShot 2024-07-02 at 02 42 15

So it's not related to the type of API but to the technique of using it.

ejbills commented 3 days ago

Wasn't talking about the lack of the screen recording notification, more about how the 'wins' app has support for multiple desktop spaces. I suspect once I migrate to the screen capture kit method of capturing window images, the screen recording notification will be mitigated as it is a new system. I will do some more testing.

ShlomoCode commented 3 days ago

I suspect once I migrate to the screen capture kit method of capturing window images, the screen recording notification will be mitigated as it is a new system.

I don't see a reason for it to be like this, after all it comes to warn that an application is watching the screen for a long time. What does it matter through which API.