Setting High Resolution on Linux

I prefer big 17-inch screens on my laptops with 1920×1080 resolution. The money is worth it for the extra screen real estate, especially with as many apps as I use at once. A few years ago my main laptop with a 17-inch 1920×1080 screen was acting flakier with age. I needed a backup laptop to act as a secondary. The way my main was behaving, the new one might too soon become my primary.

Within the year, it did.

Spare cash was sparse at the time. Couldn’t get the preferred power system, so I bought a less expensive laptop with a 15-inch screen. Native max resolution was 1366×768.

To help organize my apps I use distinct workspaces. Think of them as multiple desktops. On Fedora 25, GNOME gives as many dynamic workspaces as I care to use. Open an app on the last desktop and it automatically creates an extra empty workspace. Remove the last app from a desktop and GNOME deletes that desktop.

Note: XFCE on Qubes v3.2 has static workspace creation. Create as many as you want even if you don’t use all of them. I have 9 in a 3×3 square. Each workspace in the square represents one kind of work for me. I always use the same workspace for the same general operations, sometimes two workspaces if things get too crowded.

The new system’s1366x768 screen? Pfui! With so much to fit, any resolution less than 1920×1080 is too crowded. I needed more screen real estate.

Finding Your Resolution

Using xdpyinfo(1) is a quick way to see your resolution on Linux. Open a terminal and run:

$ xdpyinfo | egrep dim
 dimensions: 1920x1080 pixels (508x285 millimeters)

Isolating “dim” for “dimensions” shows only the relevant fact from xdpyinfo‘s huge output.

With only 1366×768 on my new laptop, I needed xrandr(1) to force the graphics chipset into the preferred resolution. Don’t have to stick with the native max if a bigger one is scalable and readable.

Note: Remember that “cmdname(1)” means that cmdname is in the man pages, section 1. In the shell use

$ man cmdname


$ man 1 cmdname

to read it. Section numbers are explained in man(1) — use the “man man” command — but the only time you have to use section numbers is if a name appears in more than one section.

Resolving Your Choices

Typical GUI display apps show the current screen resolution and offer the existing mode settings list as alternatives. These present a simple interface to the RandR (Resize and Rotate) operations. To change resolution to something not in the mode list, use xrandr on the command line. Run it without options to see current settings.

Here is the report from my older 1920×1080 laptop, still running with light, noncritical usage:

$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
LVDS-1 connected primary 1920x1080+0+0 (normal left inverted right
x axis y axis) 382mm x 215mm
   1920x1080     60.01*+
   1680x1050     59.95 
   1400x1050     59.98 
   1280x1024     59.89 
   1280x960      59.94 
   1152x864      59.96 
   1024x768      59.92 
   800x600       59.86 
   640x480       59.38 
   720x400       59.55 
   640x400       59.95 
   640x350       59.77 
DVI-I-1 disconnected (normal left inverted right x axis y axis)
eDP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)

In my older laptop, 1920×1080 is the current setting and the native mode list shows it as one of the built-in mode settings. The minimum shown is quite small, the old IBM CGA 320×200, but look at that maximum: 16384×16384. Such a size allows extending the desktop across multiple screens. With that size I could have as much as 8 screens across and 15 screens high.

Growing from 1366 to 1920 and from 768 to 1080 isn’t a big stretch. It increases resolution by about 40.5% in both dimensions. Here’s the output for my 1366×768 laptop after xrandr changed it:

$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
LVDS1 connected 1920x1080+0+0 (normal left inverted right x axis y
axis) 344mm x 194mm panning 1920x1080+0+0
   1366x768      60.04*+  40.02 
   1280x720      60.00 
   1024x768      60.00 
   1024x576      60.00 
   960x540       60.00 
   800x600       60.32    56.25 
   864x486       60.00 
   640x480       59.94 
   720x405       60.00 
   680x384       60.00 
   640x360       60.00 
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

The current setting is 1920×1080 even though the native mode list maxes out at 1366×768. And look at that max! This shows xrandr can set what the built-in modes do not offer.

On Qubes, real xrandr info comes only on dom0, the master domain from which all other operations spring. Application VMs (AppVMs) show settings inherited from dom0, but the native mode list is unavailable on any AppVM because they do not have direct access to the video device interfaces. Remember: Qubes uses Security by Isolation.

Here’s what xrandr shows in an AppVM:

$ xrandr
Screen 0: minimum 64 x 64, current 1920 x 1080, maximum 32767 x 32767
DUMMY0 connected 1920x1080+0+0 0mm x 0mm
   QB1920x1080 46.10*+
DUMMY1 disconnected
DUMMY2 disconnected
DUMMY3 disconnected
DUMMY4 disconnected
DUMMY5 disconnected
DUMMY6 disconnected
DUMMY7 disconnected
DUMMY8 disconnected
DUMMY9 disconnected
DUMMY10 disconnected
DUMMY11 disconnected
DUMMY12 disconnected
DUMMY13 disconnected
DUMMY14 disconnected
DUMMY15 disconnected

Setting a New Resolution

Options in xrandr seem daunting because of the amount of control available. Here’s how to set the resolution:

$ xrandr --output PRIMARY --scale-from WxH --panning WxH --fb WxH

Change PRIMARY to the name of your display device, such as LVDS, HDMI, VGA, or whatever xrandr sees as connected that you want to change. Use the name that xrandr gives. One system might use the name “LVDS1” while another uses “LVDS-1” instead. Each WxH refers to the width and height numbers to use, separated by a lowercase letter “x”. Notice the last three options use the same numbers.

Typing all this repeatedly to experiment with screen sizes is a pain, even with command line editing, because of those repeated resolutions. Instead, use the following script, named newres:


# newres
# Set the screen to a new resolution as identified on the command line
# by WxH, e.g., 1366x768 or 1920x1080.

if (( "$#" < 1 ))
  echo "Missing new resolution!"                                      1>&2
  echo "Usage: $0 WxH"                                                1>&2
  echo "where WxH is the new resolution, e.g., 1366x768 or 1920x1080" 1>&2
  echo "Use xrandr to see what you have set."                         1>&2
  exit 1


primary="$(xrandr | egrep " connected " | cut -d' ' -f1)"

xrandr --output ${primary} --scale-from ${res} --panning ${res} --fb ${res}

Put this script in your ~/bin directory, chown(1) it to yourself, and use chmod(1) to make it executable by only yourself. Run it on the command line with one WxH number pair to change your resolution. If you use a resolution that results in extreme difficulty, reexecute it using your native resolution to restore it to normal.

Beware of aspect ratios when playing with resolutions. The width divided by the height should have the same ratio as your screen’s native resolution or a close approximation. Notice that 1920×1080 is a 16:9 ratio (1.7777777…) while 1366×768 is a 683:384 ratio (1.7786458). Not exactly the same, but they’re so close, a true 16:9 ratio works nicely.

Note: Knowing the aspect ratio and given a desired width, calculate the 16:9 height by multiplying by 9 then dividing by 16. Knowing the desired height, multiply by 16 then divide by 9 to get the width. For the obvious example, using 16:9 with a 1920 width, the height should be 1920*9/16=1080, and given a 1080 height, the width is 1080*16/9=1920. To match a 683:384 ratio for a 1920 width, the height would be 1920*384/683=1079.4, close to 1079, and given a 1080 height, the width would be 1920.9, close to 1921. Fractional pixels aren’t allowed. Notice that 1920/1079 is 1.7794254, which is slightly more than the 16:9 ratio than 1366×768, and that 1921/1080 is 1.7787037, much closer to the 16:9 ratio, but still slightly more than 1366×768. Do not use odd numbers in resolutions. Even numbers scale better. Thus, neither 1921 nor 1079 works.

Default Resolution at Login

Save the following file into ~/.config/autostart/newres.desktop:

[Desktop Entry]
Exec=/home/lreznick/bin/newres 1920x1080
Comment[en_US]=Set 1920x1080 resolution
Comment=Set 1920x1080 resolution

The Desktop file format is a Freedesktop standard used by GUIs describing how applications launch in a GUI. When set, the next login will get the new resolution.

Note: If using Qubes, open a dom0 terminal and put this same file into the ~/.config/autostart directory. Don’t forget to change the “Exec” line’s pathname to use your own dom0 home directory path. Be sure the right resolution is on that line and in the “Comment” lines. On Qubes, all workspaces will show that resolution and so all AppVMs will use it.

Leave a Comment