Improve hide and show main window on Ubuntu