Customizing screen resolutions with xrandr
Screen Makeover
You can boost productivity on an old laptop using xrandr to quickly and easily gain some extra screen real estate.
If you are anything like me, you may have an old laptop from the mid-2010s lying around that still works well but has some obvious deficiencies. While the hardware is mostly fine, the 15.6-inch screen has bezels that encroach well into where we now expect to see uninterrupted screen space. With a few modifications, this old laptop is a perfect candidate for a backup Linux machine for when your main laptop inevitably fails (even if you do need to carry the charger with you at all times). After buying a pair of 4GB DDR3 sticks and the least expensive 120GB SSD you can find and installing Ubuntu, this old laptop runs great, but the screen still feels like something from the Windows ME days. All you need is a few simple terminal commands using xrandr
on Ubuntu [1] to bring the 1366x768-resolution screen up to something a bit more reasonable, greatly improving your overall experience.
There are a few caveats, however. One is that bumping up the resolution will likely cause text to appear fuzzy and less crisp. This is something that most users can become accustomed to in time. It won't look pretty, but at least you will be able to have more than one document or program window open at the same time. Another caveat is that you will likely experience, at the very least, some tearing when moving windows around – nothing that will affect performance in any meaningful way, as long as you don't need high graphic fidelity. Lastly, and obviously, you should probably avoid using this laptop for any video or image production because having an accurate representation on your screen is paramount for those kinds of tasks. With these caveats in mind, let's break down the process.
Custom Resolution
First you need to determine the base X Window System [2] configuration to which your custom resolution will be added. To do this, open a terminal window and run:
$ xrandr
For reference later, write down which display output is being used. This will be something like HDMI-#
, DP-#
, LVDS-#
, or VGA-#
(where the #
is typically a
or 1
). The first section indicates the connection technology, and the digit indicates the monitor number. This will be important to know later. For example, Figure 1 shows the output from xrandr
for the Dell E6430 14-inch laptop, circa 2012, that I used to write this article.
Next, determine your monitor's characteristics at your selected resolution. You will want to continue to use the same aspect ratio (width to height) when scaling to a higher resolution. For instance, a 1366x768 monitor that is 14 inches or larger can typically accommodate any 16:9 resolution up to 2560x1440 while still offering fairly legible text. To determine the characteristics needed, run the following command:
$ cvt <desired width in pixels> <desired length in pixels>
Running this cvt
command on my Dell for a desired resolution of 1920x1080 results in the information shown in Figure 2.
The modeline listed in the cvt
command's output shown in Figure 2 should also be noted because that, too, will be used later. At this point, use the xrandr --newmode
command to add the desired mode to the configuration. Copy and paste the modeline information after xrandr --newmode
so that the correct timings and resolution will be used (Figure 3).
Finally, use the xrandr --addmode
command followed by the desired resolution and frequency (Figure 4), which will then be accessible in the Gnome Display Settings panel in the Gnome Control Center (Figure 5).
Persistence
Now you can open the Gnome Control Center and choose the desired resolution. You can then see how good (or bad) the new resolution looks on your particular machine. However, there is one problem at this point: When you sign out or reboot, your custom resolution will no longer be in the Gnome Control Center, forcing you to re-enter these commands in the terminal to access the resolution each time you sign in.
There is a simple workaround for this problem: Add the newmode
and addmode
commands to the end of the .profile
file in your /home/user directory
(Figure 6). I prefer to simply open Home
, view hidden files by using Ctrl+H, open the .profile
file with gedit, copy and paste those two commands at the very bottom, and save. Pressing Ctrl+H again will hide the hidden files once more and resume the default view. Now the resolution change will survive reboots and logout/login for the user whose .profile
was amended. Purists may want to use Vim or nano, but to each his or her own. If you're feeling indecisive, you can always run
gedit /home/<user>/.profile
from the terminal and add the two needed lines that way.
Conclusion
With a few simple commands in the terminal, you can use xrandr
to customize the resolution on older machines, breathing new life into old hardware.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.