If a CAPI/Cocoa window is busy and unresponsive you can use the break gesture Command+Ctrl+,
(comma) to regain control.
You can use set-application-interface on an instance of a subclass of cocoa-default-application-interface to get the following functionality:
A proper Cocoa application is likely to use this mechanism. Note that the call to set-application-interface needs to happen before any display or attempt to access the screen. See cocoa-default-application-interface for more details.
CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:54