The new function capi:screen-active-interface returns the currently active interface on a given screen or (on Windows) a MDI document container.
capi:screen-active-interface