Ubuntu 16.04 & Nvidia - Adding external monitor stretches single display across both monitors

I'm trying to run an external monitor from my HP laptop running 16.04 via HDMI. I have a GTX965M that I'm running the nvidia-375 driver for. This lets me run two monitors but only in mirror mode. If I change to use separate monitors the resolution seems to spread across the total of the two displays and I'm unable to cancel the setting changes as I can only click on the launcher; I have to wait the 30 seconds for revert.

I followed this post from the forums to install a newer version of the drivers as it is faster than going through Software & Updates which seems to take too long.

Here is an image of my desktop after trying to add a second separate monitor:

desktop

I'm not sure whether this comes down to the drivers or the system config.

Any help is appreciated

Update: It has randomly started to work and I'm not sure why because I haven't made any changes. I just booted up and plugged in the HDMI. Also, my nvidia-settings doesn't appear correct according to the one of the suggested solutions so I'm not confident that this isn't a temperamental bug.

nvidia-settings

This shows only one monitor, the external. It doesn't include the laptop's built in. Is this correct?

------------------------------------------------------------------------------------------------------------------------------------

Further Update: Then the next time I boot up, this time with the HDMI already plugged in it's back to stretching a single 1920x1080 across two 1080p monitors. I think I have got to the route of the problem. I opened up a terminal to get to nvidia-settings and apparently it's not installed.

This is bizarre as it 100% was installed; proven by the image I supplied in this question. I humored this problem and reinstalled and dual monitors is working again! Is this a bug?? I've added a solution myself because this did solve the problem but I don't understand how it can occur.


Solution 1:

Press Ctrl+Alt+T to go to a terminal and type:

nvidia-settings

then you'll see something like this screen: nVidia xserver settings

From the left pane,

  • choose X Server Display Configuration
  • click the secondary screen in the dialog window
  • click Configure.
  • Enable TwinView.

If it doesn't work immediately, reboot the computer.

Solution 2:

I had the same problem and I solved using compizconfig. In General Options → Display Settings disable Detect Outputs and set the outputs format.

compizconfig