Search This Blog

Tuesday, November 27, 2012

Adjusting resolution on ubuntu

I have a problem with my Ubuntu display resolution which everytime I switch between my KVM machines, my Ubuntu's resolution will be set back to the default one( lower resolution than the one I wanted). To fix this problem, I will have to forcing Ubuntu to pre-set a custom resolution every time Ubuntu detects my montior is being connected.

Step1:
Show all possilbe resolution:

$xrandr

then you will see something like this as a result:

Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
DIN disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 433mm x 271mm
   1680x1050      60.0*+
   1280x1024      75.0     60.0  
   1280x960       60.0  
   1152x864       75.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  

Step2:
Find out what values are required for creating a new profile for ur custom setting

$cvf [resolution] [Frequency]

for example, I want to use the highest possible resolution,

$cvf 1680x1050 60

Then I will get an output looking like this:

# 1696x60 51.40 Hz (CVT) hsync: 3.91 kHz; pclk: 8.25 MHz
Modeline "1696x60_60.00"    8.25  1696 1744 1904 2112  60 63 73 76 -hsync +vsync

Step3:
Testing new resolution settings

xrandr --newmode [new resolution profile name] [copying the result of the setting from the previous output]
xrandr --addmode [output channel] [new resolution profile name]
xrandr --output [output channel]  --mode [new resolution profile name]

Here is an example:
xrandr --newmode "1696x60_60.00"    8.25  1696 1744 1904 2112  60 63 73 76 -hsync +vsync
xrandr --addmode DVI-0 "1696x60_60.00"
xrandr --output DVI-0 --mode "1696x60_60.00"

Step4:
Create/Append your previous commands as setting to the autorun script at ~/.xprofile

gedit ~/.xprofile

Paste the following line to the file

xrandr --newmode "1696x60_60.00"    8.25  1696 1744 1904 2112  60 63 73 76 -hsync +vsync
xrandr --addmode DVI-0 "1696x60_60.00"
xrandr --output DVI-0 --mode "1696x60_60.00"

Save and restart Ubuntu to verify if it works.


No comments:

Post a Comment