Prevent SwiftUI to stop rendering UI when window loses focus.

Hello, I am writing an audio utility, with a typical audio track player, in SwiftUI for macos 26.

My current problem is that the SwiftUI stops rendering the main window UI when the window loses focus.
This is a problem since even clicking on the app menu bar has the window loose focus, and the timer, time cursor and all animations of the audio piece stop.

All baground services, audio, timers and model continue running (even tho with some crackling on the switch). Once the window focus is re-obtained the animations continue and skip to current state.

I have read that SwiftUI optimizes macos like ios, and disables the ui run loop, but there must be a way to disable, since this obviously not the case for most mac app.

Is there a solution with either SwiftUI or involving AppKit?

A correction, the window's UI stops rendering updates only when the menu bar is clicked and focused.

When the window is in background the animations continue being updated and rendered.

Is there maybe something wrong with the macos menu bar RunLoop?

Prevent SwiftUI to stop rendering UI when window loses focus.
 
 
Q