Who does not use an external monitor while using a laptop? I don’t need to know the names. But I can assure you, I certainly do. I also have to frequently switch between operating systems (for using different sets of softwares. Yes, I know VM works fine, but I just like to have things neat), specially Windows and Linux (Ubuntu). Right now I am using Windows 10 and Ubuntu 16.04 on my Lenovo X230T. When I connect an external monitor to my laptop it works perfectly fine for the Windows but in case of Ubuntu i can not set the maximum resolution for my extended monitor (which is 1920 X 1080). I just don’t see the option 1920 X 1080 there, when I connect my external monitor while running Ubuntu 16.04 (I had the same problem for Ubuntu 14.04). What I expect to see is this (this is a screen-shot taken after the troubleshooting):
After a few minutes of googling I found the solution to be pretty easy. First we need to know the maximum (wanted) resolution of the external monitor. I am using an HP 23es which has a maximum resolution of 1920×1080 with 60Hz refresh rate (googling or looking at the manual works just fine). We also need to know the name of the connection (VGA/HDMI etc). To know the name we need to run a command on the terminal.
shanto@shanto:~$ xrandr Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192 LVDS-1 connected primary 1366x768+0+312 (normal left inverted right x axis y axis) 277mm x 156mm 1366x768 60.02*+ 1360x768 59.80 59.96 1024x768 60.04 60.00 960x720 60.00 928x696 60.05 896x672 60.01 960x600 60.00 960x540 59.99 800x600 60.00 60.32 56.25 840x525 60.01 59.88 800x512 60.17 700x525 59.98 640x512 60.02 720x450 59.89 640x480 60.00 59.94 680x384 59.80 59.96 576x432 60.06 512x384 60.00 400x300 60.32 56.34 320x240 60.05 VGA-1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm 1024x768 60.00 800x600 60.32 56.25 848x480 60.00 640x480 59.94 1920x1080_60.00 59.96* HDMI-1 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) HDMI-2 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis)
We can see from line 24 that VGA-1 is the connected monitor (for demonstration I ran this command after the troubleshooting, that’s why it shows 1920×1080). That is not important. We just need to remember the name VGA-1. Let’s start working.
Step 1: Write the following command in Terminal. The resolution information might be different for different monitor.
shanto@shanto:~$ cvt 1920 1080
This will provide an output like:
shanto@shanto:~$ cvt 1920 1080 # 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Step 2: Now we need to copy the text from the output of the previous command from the end of the word ‘Modeline’ (will not be the same for all machines) and run the following command on terminal. This will not provide any output.
shanto@shanto:~$ xrandr --newmode 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Step 3: Now we need to add it to the output using the following command (so that we can see it when we want to change the resolution). Again this part “VGA-1 1920x1080_60.00” will depend on the particular machine. Some machine might name it VGA1, or if you connect it with HDMI it might show HDMI-1 or something.
shanto@shanto:~$ xrandr --addmode VGA-1 1920x1080_60.00
We are almost DONE. Now we need to go to Screen Display from the following GUI and we should find the newly added resolution on the drop-down list (we should be able to see the first image).
NOT DONE YET!
It should work fine for now. However, if we restart the machine it might loose the current state. In my case, after restarting it showed a message like: ‘Could not apply the stored configuration for monitors‘ and the higher resolution option was gone. What we need to do is to save the state in a .xprofile file in the home folder (in my case that is /home/shanto). These are the lines we need.
shanto@shanto:~$ cd ~ # go to home shanto@shanto:~$ touch .xprofile # create a file .xprofile in home directory shanto@shanto:~$ nano .xprofile # open the file in nano editor
This will open the file .profile in the Nano editor (use whatever text editor you are comfortable with). Write the following lines in the file and save it. It should be pretty clear by now that, the information written in the file like 1920×1080 VGA-1 will be different for different machines.
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync xrandr --addmode VGA-1 1920x1080_60.00
Now, if you check your home directory using
ls -a command in the terminal, you should be able to find a file named .xprofile.
DONE! It should work fine even after restart. Cheers!