VISIONOS: how to detect if the user closes a window vs a window going into the background

For context, we have a fully immersive application running on visions. The application starts with a standard View/menu, and when the user clicks an option, it takes you to fully immersive mode with a small floating toolbar window that you can move and interact with as you move around the virtual space. When the user clicks the small x button below the window, we intercept the scenePhase .background event and handle exiting immersive mode and displaying the main menu. This all works fine.

The problem happens if the user turns around and doesn't look at the floating window for a couple of minutes. The system decides that the window should go into the background, and the same scenePhase background event is called - causing the system to exit immersive mode without warning. There seems to be no way of preventing this, and no distinction between this and the user clicking the close button.

Is there a reliable way to detect if the user intentionally clicks the close button vs the window from going into the background through lack of use? onDisappear doesn't trigger.

thanks in advance

Answered by Vision Pro Engineer in 792769022

Hey @slantedmark,

Your view will go into the .background scene phase due to either the window being backgrounded by the system or due to the user closing the window. Have you considered using a gesture or another visual affordance within your immersive view to reopen the window?

Additionally, if you could file enhancement requests using Feedback Assistant that would be great. Please do request this functionality and provide as much detail about your use-case as you can!

Thanks,

Michael

Accepted Answer

Hey @slantedmark,

Your view will go into the .background scene phase due to either the window being backgrounded by the system or due to the user closing the window. Have you considered using a gesture or another visual affordance within your immersive view to reopen the window?

Additionally, if you could file enhancement requests using Feedback Assistant that would be great. Please do request this functionality and provide as much detail about your use-case as you can!

Thanks,

Michael

VISIONOS: how to detect if the user closes a window vs a window going into the background
 
 
Q