Update the width of main window dynamicly