Focus not correctly restored when closing hotkey window
When closing the hotkey window focus is not restored to the window which had it before pressing the hotkey. This only seems to happen when at least two displays are connected and an iTerm window is open on a different display than the hotkey window is on. The specific configuration I've tested this with is a MacBook Pro (Retina, 15-inch, Mid 2015) with two external displays. My main display is the built-in laptop display, which is where the hotkey window opens.
- iTerm2 version: Build 3.1.20170329-nightly
- OS version: 10.12.4 (16E195)
Detailed steps to reproduce the problem:
- Start with iTerm configured to open a hotkey window on the primary display.
- Open a regular iTerm window on the secondary display.
- Start another application (could be anything) on the primary display. Click its window to give it focus.
- Press the hotkey to open the hotkey window. The hotkey window now has focus.
- Press the hotkey to dismiss the hotkey window. The iTerm window on the secondary display now has focus.
What happened: Focus given to another iTerm window when hotkey window is dismissed.
What should have happened: Focus should be returned to the app which was in use before the hotkey window was opened.
Notes:
- If a regular iTerm window is open on the primary display and not the secondary, focus is correctly given back to the app.
- If regular iTerm windows are open on both the primary and secondary displays, behavior changes depending on which iTerm window most recently had focus:
- If the iTerm window on the primary display most recently had focus (focus iTerm window on primary, focus different app, invoke hotkey window, dismiss hotkey window) then the non-iTerm app ends up with focus as it should.
- If the iTerm window on the secondary display most recently had focus (focus iTerm window on secondary, focus different app, invoke hotkey window, dismiss hotkey window) then the iTerm window on the primary ends up with focus.