Well, here goes my info/opinion on the whole thing :
You could probably use $widget->screenheight() and $widget->screenwidth(), taking into account your window size, and calculate a centering point. Then use $main->geometry() to move the window there.