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
-
First Release Candidate for Linux Kernel 6.14 Now Available
Linus Torvalds has officially released the first release candidate for kernel 6.14 and it includes over 500,000 lines of modified code, making for a small release.
-
System76 Refreshes Meerkat Mini PC
If you're looking for a small form factor PC powered by Linux, System76 has exactly what you need in the Meerkat mini PC.
-
Gnome 48 Alpha Ready for Testing
The latest Gnome desktop alpha is now available with plenty of new features and improvements.
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.