Added a second monitor to my laptop with Ubuntu

I decided to move my 21″ monitor from my desktop computer to my laptop that runs Ubuntu. Since I have a DVI interface on my monitor and a HDMI interface on my laptop I had to buy a adapter. I bought one at Clas Olson and it worked perfectly.

Ok, now I had to switch my primary monitor so my external monitor holds the panels instead of the built in monitor that is the default monitor. After a quick google I found this perfect blog post that describes the problem and has a nice solution. Kudos to you Andrew.

First we have to create a shell script.

# Author: Andrew Martin
# Credit:
echo "Enter the primary display from the following:" # prompt for the display
xrandr --prop | grep "[^dis]connected" | cut --delimiter=" " -f1 # query connected monitors
read choice # read the users's choice of monitor
xrandr --output $choice --primary # set the primary monitor

Save it with the name
Make the script executable with ‘chmod +x Now it’s time to run the script.

~$ ./
Enter the primary display from the following:

As you can see I choose the DFP1 as my primary monitor.

Done. 🙂