Setting/Centering the Horizontal Display Position on Ubuntu or Linux

Linux is notorious in positioning the horizontal position on your monitor. After installing the Ubuntu on my old Sony Vaio PCV-RX650, which has a Nvidia TNT2 display card, I found the display is shifted to the right, leaving a blank strip on the left and distorted image on the right. This was very annoying. I had to re-adjust the monitor every time. This was one the reasons I gave up on Linux a few years back. You’d never see this kind of problem on Windows. I’m determined to find the fix for this.

So, I ventured into Google and found a few tricks to set the display correctly once and for all.
First, run the “xvidtune” to determine all the parameters needed to adjust the display. See below:

xvidtune.png

This software is not really intuitive. You’d need to click “left” or “right” and then click “apply” to see the effect. Keep doing this until you get the desired screen fit and then click “show” to show the parameters on the terminal. Copy the output.

Then gedit or vi the following file /etc/X11/xorg.conf, which I append below:
paste the line in between the “Monitor” Section as follows:

Section “Monitor”
Identifier “Generic Monitor”
Option “DPMS”
HorizSync 30-83
VertRefresh 55-76
Modeline “NV1280x1024” 135.00 1280 1312 1456 1688 1024 1025 1028 1066 +hsync +vsync

You’d need to the prefix of “Modeline” in front of the line. Notice that I added “NV” (or any thing to make it unique) in front of “1280×1024”. Well this is really the trick that took me over a couple hours to figure out. This string “NV1280x1024” needs to have a same counter part in the Display Section. In my case, it is as follows:

SubSection “Display”
Depth 24
Modes “NV1280x1024”
# Modes “1280×1024” “1024×768” “800×600” “640×480”
EndSubSection

Notice that I comment out the original lines and all other Display sections so I can force X display
to use this particular mode I just specified. You may want to have more than one mode after you become more familiar with how the file works.

Save the file then refresh the display by doing
CTRL-ALT-BACKSPACE

The display should be what you intended. If not, keep editing the /etc/X11/xorg.conf file until you get what you want.
There it is. A bit tedious.

Appendix: My /etc/X11/xorg.conf file contents – your file may be different.
#=====================================================
# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf(5) manual page.
# (Type “man xorg.conf” at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg

Section “Files”
FontPath “/usr/share/fonts/X11/misc”
FontPath “/usr/share/fonts/X11/cyrillic”
FontPath “/usr/share/fonts/X11/100dpi/:unscaled”
FontPath “/usr/share/fonts/X11/75dpi/:unscaled”
FontPath “/usr/share/fonts/X11/Type1”
FontPath “/usr/share/fonts/X11/100dpi”
FontPath “/usr/share/fonts/X11/75dpi”
# path to defoma fonts
FontPath “/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType”
EndSection

Section “Module”
Load “i2c”
Load “bitmap”
Load “ddc”
Load “dri”
Load “extmod”
Load “freetype”
Load “glx”
Load “int10”
Load “vbe”
EndSection

Section “InputDevice”
Identifier “Generic Keyboard”
Driver “kbd”
Option “CoreKeyboard”
Option “XkbRules” “xorg”
Option “XkbModel” “pc105”
Option “XkbLayout” “us”
EndSection

Section “InputDevice”
Identifier “Configured Mouse”
Driver “mouse”
Option “CorePointer”
Option “Device” “/dev/input/mice”
Option “Protocol” “ImPS/2”
Option “ZAxisMapping” “4 5”
Option “Emulate3Buttons” “true”
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “stylus”
Option “Device” “/dev/input/wacom”
Option “Type” “stylus”
Option “ForceDevice” “ISDV4” # Tablet PC ONLY
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “eraser”
Option “Device” “/dev/input/wacom”
Option “Type” “eraser”
Option “ForceDevice” “ISDV4” # Tablet PC ONLY
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “cursor”
Option “Device” “/dev/input/wacom”
Option “Type” “cursor”
Option “ForceDevice” “ISDV4” # Tablet PC ONLY
EndSection

Section “Device”
Identifier “Generic Video Card”
Driver “nv”
BusID “PCI:1:0:0”
EndSection

Section “Monitor”
Identifier “Generic Monitor”
Option “DPMS”
HorizSync 30-83
VertRefresh 55-76
Modeline “NV1280x1024” 135.00 1280 1312 1456 1688 1024 1025 1028 1066 +hsync +vsync

EndSection

Section “Screen”
Identifier “Default Screen”
Device “Generic Video Card”
Monitor “Generic Monitor”
DefaultDepth 24
# SubSection “Display”
# Depth 1
# Modes “1280×1024” “1024×768” “800×600” “640×480”
# EndSubSection
# SubSection “Display”
# Depth 4
# Modes “1280×1024” “1024×768” “800×600” “640×480”
# EndSubSection
# SubSection “Display”
# Depth 8
# Modes “1280×1024” “1024×768” “800×600” “640×480”
# EndSubSection
# SubSection “Display”
# Depth 15
# Modes “1280×1024” “1024×768” “800×600” “640×480”
# EndSubSection
# SubSection “Display”
# Depth 16
# Modes “1280×1024” “1024×768” “800×600” “640×480”
# EndSubSection
SubSection “Display”
Depth 24
Modes “NV1280x1024”
# Modes “1280×1024” “1024×768” “800×600” “640×480”
EndSubSection
EndSection

Section “ServerLayout”
Identifier “Default Layout”
Screen “Default Screen”
InputDevice “Generic Keyboard”
InputDevice “Configured Mouse”
InputDevice “stylus” “SendCoreEvents”
InputDevice “cursor” “SendCoreEvents”
InputDevice “eraser” “SendCoreEvents”
EndSection

Section “DRI”
Mode 0666
EndSection

6 thoughts on “Setting/Centering the Horizontal Display Position on Ubuntu or Linux”

  1. I have got one idea for your webpage. It appears like right now there are a number of cascading stylesheet issues while opening a selection of web pages within google chrome and internet explorer. It is operating alright in internet explorer. Possibly you can double check that.

  2. I’ve been surfing online more than 3 hours today, yet I never
    found any interesting article like yours. It’s pretty
    worth enough for me. Personally, if all website owners and bloggers made good content as you did,
    the internet will be a lot more useful than ever before.

  3. Hurrah, that’s what I was seeking for, what a information!
    present here at this website, thanks admin of this web page.

  4. Its such as you learn my mind! You seem to grasp a lot about this, like you wrote the e-book in it or something.
    I think that you could do with some percent to pressure
    the message home a little bit, but other than that, that is fantastic
    blog. A fantastic read. I’ll certainly be back.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.