I use TextMate to write my git commit messages. I also use (and love) the iTerm2 Hotkey/Visor window. For the past few months, after saving and closing the commit in TextMate, a new iTerm2 session would launch.
This new session looked like a hotkey window, but didn’t behave like one and effectively masked the actual Visor. If you’re reading this, you’ve likely experienced this issue, so you know how annoying it can become during a long work session.
It uses GetFrontProcess() when initially invoked and then SetFrontProcess() with the obtained process serial number when it is time to return focus to the terminal.
I suggest the user … reset the launch services database:
This worked for me. I hope it works for you too.