It’s very simple
1. Connect the projector to your laptop.
2. Do this in command line.
sudo dpkg-reconfigure xserver-xorg
3. Just press Enter through every screen.
4. Restart X for the changes to take effect by pressing CTRL + ALT + BACKSPACE.
5. Log in again as you always do.
6.And finally, the projector will automatically display your Ubuntu
desktop and you can show off your desktop effects to your co-workers.