Ubuntu 16.04 Dell XPS 15 does not detect external Monitor using HDMI

Do everything from a virtual console when it comes to NViDIA graphics drivers installation.
Also detach your external monitor during the NVIDIA graphics drivers installation process.
You have the latest drivers installed, so the Graphics Drivers PPA should already be added.

First completely uninstall every NVIDIA drivers and software you currently have installed.

Start the notebook and mark the Ubuntu entry in the GRUB boot menu, then press the E key.
Add nouveau.modeset=0 at the end of the linux line. Press the F10 key to boot the system.
Do not miss to set a Space between the last letter in the linux line and nouveau.modeset=0.

When the login screen appears press Ctrl+Alt+F1.
Enter your user name and password and then execute :

sudo apt purge nvidia*
sudo reboot  

Now re-install the latest stable NVIDIA drivers 378 (support NVIDIA GEFORCE GTX 960M).

After that restart mark the Ubuntu entry in the GRUB boot menu again, then press the E key.
Add nouveau.modeset=0 at the end of the linux line. Press the F10 key to boot the system.
Do not miss to set a Space between the last letter in the linux line and nouveau.modeset=0.

When the login screen appears press Ctrl+Alt+F1.
Enter your user name and password and then execute :

sudo apt update
sudo apt install nvidia-378 nvidia-prime
sudo reboot  

Make sure that the NVIDIA graphics are in use in the NVIDIA X Server Settings -> PRIME Profiles.
In case they are not in use switch to them, logout of the session and back in or reboot the system.
Now re-attach the external monitor to the HDMI port and it should be recognized right properly.

Update addressing your comment that it still does not work

Boot into the BIOS of your notebook and check whether you explicitly have to enable external monitor support - in some newer machines, especially in those with NVIDIA Optimus technology this option is implemented. Also check in System Settings / Displays whether you have to adjust something there.


The issue might be with the nvidia graphics driver.Which can be fixed by following the steps below : Run the following commands in the terminal:

sudo apt-get purge nvidia-*

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt-get update

sudo apt-get install nvidia-364

Reboot and your graphics issue should be fixed.