Using Linux on a laptop has always been a hit and miss affair. With sometimes obscure proprietary hardware, many laptop manufacturers have showed no interest in supporting the free operating system. Nevertheless, through hard work by developers and support from some hardware manufacturers, Linux now supports a wide variety of laptops and netbooks.

Many laptop owners often connect their machines to external displays, whether monitors, televisions, or projectors. For display chips that support XrandR, the setup is usually rather simple. For users with Nvidia chips, it is still easy but not quick. To switch to an external display, you either have to configure it in the xorg.conf file to automatically recognize it or use nvidia-settings and click through a series of options each time you want to use it.

With Disper, a free on-the-fly display switching utility, you can quickly and easily switch to an external display, clone your screens, extend a display, and choose from any of the supported resolutions. Disper is a command line utility, but after a few initial command entries, you can easily bind it to a shortcut key or run it from a single command by using a basic script.



Installation

The Disper website lists binary package archives for Ubuntu, ArchLinux, and OpenSUSE. Follow your distribution’s normal installation procedures to install. For all other distributions, Disper uses python and is easy to install from source. To install:

1. Download the latest version

2. Open a terminal window

3.. Extract the contents of the archive:

4. Go to the src/ directory:

5. Type:

Alternative, you can run the program without installing, directly from the src directory:

Initial Setup

Disper should recognize your VGA, DVI, or HDMI connection right away. The first thing to do with Disper is to identify your displays. Enter the following command:

The output will look like this:

Note: I truncated the lower resolutions, but the full list will show all of them.

Usage

If you just want to clone your display, you can enter one command:

Unfortunately, if your device has an odd maximum resolution like my netbook (1366×768), this will result in both screens switching to something like 1024×768. That may be fine for projectors, but if you want to play movies, TV shows, or games on your television, for example, you will want to use custom settings.

For example, if I wanted to display only on my television in 720p resolution, I would enter:

The uppercase “S” refers to the external display. To switch back to the default netbook display, I would enter:

This will automatically detect the default resolution and return to it. (Notice the lowercase “s”).

At any time, you can have Disper display the current settings with:

The output will look like:

Extending the displays takes advantage of Nvidia’s Twinview, all with a single command. For example, if I wanted two screens, with my TV screen above my laptop, I would type:

This would give me a normal laptop screen plus a 1080p full resolution TV screen.

Simplifying

While typing in disper commands may be simple for some, others may not see it as having much of an advantage over using nvidia-settings or a graphical frontend for XrandR. To truly make it simple, you need to create a script and/or menu shortcuts.

For switching to the Sony TV, as in the example above, the script could be as simple as:

Make sure to make your script executable with:

You could also come up with something more complex that will automatically detect displays and switch back and forth. You could then bind the command to a shortcut using your desktop environment (For example, in KDE, use kmenuedit, where you can assign a keyboard shortcut to a command). You can also create a script for each setting and then easily switch to the one you need from the run command dialog (Alt+F2).

For more information about Disper and links to custom scripts to make switching displays easier, visit the project’s website.