Virtual resolution in Xorg: stretch your netbook screen

Last updated 2009-05-01

Abstract

Netbooks usually have weird and non-standard resolutions, such as 1024x600. This makes some dialog boxes disappear in the bottom of the screen, and users anxious on how to click the buttons. This explains how to configure X Window to have a bigger resolution than the maximum physical one the screen has. The method, as old as X Window is valid for all GNU/Linux distributions and for all Unix-es that use the Xorg X Window implementation, such as Solaris or OpenBSD.

Getting into a root console in text mode

We are going to log into a text mode terminal. To do this, logout from GNOME/ KDE , this is, get to the login prompt. When the login prompt appears, press Control+Alt+F1 at the same time. You will see a new prompt, this time text-mode. Enter your username and password.

To become root, depending on the distribution, you can use sudo or su to become root. On Ubuntu, which has sudo installed by default, use sudo

$amp; sudo -s
 (enter your password)
#

For more information regarding sudo, see this link

In Debian or any other distribution for which no sudo is installed, you will use su

$amp; su
 (enter root password)
#

Shutting down Xorg

Now, shutdown X11 using either /etc/init.d/gdm stop or /etc/init.d/kdm stop or /etc/init.d/xdm stop

depending on which display manager you use. Just try them in order. Usually Linux distributions have 6 virtual consoles, and the 7th is used by Xorg. To check that the display manager is not running, press Alt-F7. You should not see the display manager prompt, but a blank screen. Get back to the first virtual console by pressing Alt-F1

Retrieving Xorg configuration

We are going to use the most ancient method of configuring X window-related things: editing the Xorg configuration file. Nowadays, Xorg is so plug and play that it have a very lenient configuration file. We need to get a more verbose one to edit. To get it, run:

# Xorg -configure

This will write a file named xorg.conf.new in the current directory. Back up the original /etc/X11/xorg.conf file and put this in place. Then edit it with your favorite editor

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.default
# mv xorg.conf.new /etc/X11/xorg.conf
# vi (or whichever editor) /etc/X11/xorg.conf

Changing configuration

In the Xorg configuration file look for the lines:

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
	...
	...

Depth means the bits per pixel (color-depth) of each "Display" subsection Most likely in a modern computer (and in all netbooks), 24 bits per pixel is the default used, so we are going to configure that.

In ancient times, each "Display" subsection had a "Modes" lines specifying a list of resolutions the screen was capable to achieve. Nowadays, Xorg just auto-detect the highest resolution and stick to that. We are going to write it. If the resolution in your netbook screen is 1024x600, for example

SubSection "Display"
	Viewport   0 0
	Depth		24
	Modes		"1024x600"
EndSubSection

Now for the "virtual" part. We are going to add a "Virtual" line specifying the number of pixels we want the window manager believe we have. In our case, we say "1024x768" which is the next standard resolution and will suffice for solving our problem (seeing the buttons in the bottom of dialog boxes, remember). Feel free to experiment with higher resolutions if needed

SubSection "Display"
        Viewport   0 0
        Depth           24
	Virtual		1024 768
        Modes           "1024x600"
EndSubSection

Save the file, and that is it

Using the new resolution. Scroll

Restart gdm/kdm/xdm by issuing

# /etc/init.d/gdm start

You will see the well-known welcome screen and login prompt, but this time the bottom will be missing. Log in, and you will see your status bar... is also missing to get there, put the mouse pointer in the bottom of the screen and you will see the screen scrolling up. Now, the top menu bar disappears... you will know how to see it by now :)

Troubleshooting: Intel Cards

Intel 950 cards do not honor the ancient parameter to set virtual resolutions in X11. If you have one of those, you will have to stick to VESA or framebuffer drivers. To make a "vesa" device, search for this:

Section "Device"
	...
	...
	Identifier  "Card0"
	Driver      "intel"
	...
	...
EndSection

And add this after it

Section "Device"
	Identifier  "Card1"
	Driver      "vesa"
EndSection

Go to the "Screen" section and change the "device" so it is "Card1":

Section "Screen"
	Identifier "Screen0"
	Device     "Card1"
	Monitor    "Monitor0"
	Defaultdepth    24
	...

Restart X11 and you will get the desired effect, with one big caveat; you will lose hardware acceleration (so no fancy OpenGL graphics). That's the choice.

Pablo Martin