Switch to External Monitor Connected via HDMI/VGA port in Ubuntu

This is more like part II of the article I posted earlier about my laptop issues in Ubuntu. I finally managed to get the HDMI (possibly VGA) port working. Keep reading if you are interested.

I found that I have to connect the HDMI cable before Ubuntu is booted up. If I do that, I am able to see the external monitor in Nvidia X Server Setting window. So either connect the cable before starting the OS, or connect the cable and then restart the OS will both work. This works well, but it's rather inconvenient. I want this to be done without restarting.
Continue reading