saagarjha / Ensemble

Cast Mac windows to visionOS
https://testflight.apple.com/join/Pq1HzHqe
GNU Affero General Public License v3.0
847 stars 37 forks source link

Raise window on focus #5

Closed saagarjha closed 3 months ago

saagarjha commented 4 months ago

When interacting with a window on visionOS, it needs to be raised and made active on macOS so events go to it

billyjacoby commented 4 months ago

I'm not sure if you're accepting PRs here at all, but I was able to achieve this in my fork here.

I'd be happy to open a PR if you're okay with this implementation.

saagarjha commented 4 months ago

I appreciate the effort you've put into this, but I am actively working on this :) There's a bit more that needs to go into it to fully implement this, so I won't be taking the contribution for now.

billyjacoby commented 4 months ago

No problem at all, I'm happy to see your solution as I am definitely just a beginner with Swift in general!

saagarjha commented 4 months ago

Idle question: have you been able to get your implementation to actually work? NSRunningApplication.activate(options:) just returns false for me if another app is focused.

billyjacoby commented 4 months ago

Yeah my implementation is working for me currently. I hadn't pushed my latest changes to that branch though - I have to activate the window whenever the mouse is moved in that window. It's been kinda hit or miss though.

billyjacoby commented 4 months ago

Huh actually it looks like it only reliably works with the macOS Ensemble window, other windows seem to not be deactivated.