Restore main window state according to saved config

Authored by somsubhrabairi.