On Windows systems using Autodesk Maya, the text input field of the Script Editor doesn't regain focus after having restored focus to the main window. This event handler explicitly restores focus, if it turns out to have been the last active panel at the time of leaving the application.
Place the full contents of the script below into your userSetup.py
and never again lose focus.
Tested on Maya 2013-2016+ and is safe to use on other platforms where it simply does nothing.
- 2016-09-01: Updated with a fix for Maya 2017; thanks @martin-chatterjee!
Cheers Marcus, thanks for cooking this up!
On my side this does not work anymore in Maya 2017 (on Windows).
I just had a quick look and the following change/addition seems to work for me (at line 15)
Hope that's helpful to somebody else...
Cheers, Martin