minibuffer-selected-window

minibuffer-selected-window is a built-in function in `C source code'.

(minibuffer-selected-window)

Return the window which was selected when entering the minibuffer.
Returns nil, if selected window is not a minibuffer window.