How to minimize the main editor Window by script

I am trying to work-around a FPS issue in the editor on my build server that seems to disappear when the window is minimized. Is there a way to programmatically minimize the main editor window?

I tried

EditorApplication.ExecuteMenuItem("Window/Minimize");

but it doesn’t work (I reported an issue). I don’t seem to be able to use SendKeys either. Any idea ?

Found a way by disassembling the UnityEditor DLL.

private static void MinimizeEditorWindow () {
	// doesn't work #643951
	// EditorApplication.ExecuteMenuItem("Window/Minimize");
	System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly;
	Type T = assembly.GetType("UnityEditor.ContainerWindow");
	PropertyInfo PI = T.GetProperty("windows", BindingFlags.Static | BindingFlags.Public);
	System.Object[] windows = (System.Object[]) PI.GetValue(null, null);
	MethodInfo Minimize = T.GetMethod("Minimize");
	System.Object Res = Minimize.Invoke(windows[0],null);
}