Not updating display settings when disconnecting external monitor

There is an old bug on Launchpad - bug #306735 - which was marked invalid, the explanation being that it is a known problem but fairly complex (more explanation here).

So, as far as I know, there is not an automatic method for what you asked in the true sense. But you can use autorandr (you have to install disper first - run sudo apt-get install disper from terminal), a script by Stefan Tomanek. Using this script (autorandr) you can add a keyboard shortcut for autorandr --change command and all you have to do when you connect or disconnect an external monitor is to press that keyboard shortcut. All of these are explained very nice in this answer (I just tested in Ubuntu 13.04 and everything goes well).

After you test the script in terminal, you must to see the following post if you want to add a custom keyboard shortcut for the script:

  • How can I change what keys on my keyboard do? (How can I create custom keyboard commands/shortcuts?)