How to scale the desktop's resolution?

While using Xorg X11, on KDE/Gnome/XFCE how can we scale the display/resolution for the whole desktop and/or per application? (when this is not available on the settings GUI)

The purpose of this guide is to keep the screen resolution unchanged (at max) while scaling the size (bigger/smaller) of the desktop/applications.

The Linux display

This is detailed in depth on how does Linux’s display works? article.

On most desktops system (like KDE or Gnome) there are settings available on their respective settings panel, this guide is for additional/manual settings that can be applied to scale an application or the whole desktop. This reference article have many valuable informations for the matter.

Scaling applications

Scaling application can be done mainly via DPI, specific environment variable (explained bellow), application own setting or some specific desktop setting (out of scope of this QA).

Scaling the desktop with Xorg X11

Xorg’s extension RandR have a scaling feature and can be configured with xrandr. This can be used to scale the desktop to display a bigger environment, this can be useful for HiDPI (High Dots Per Inch) displays.

RandR can also be used the other way around, example making a screen with 1366x768 max resolution support a greater resolution like 1920x1080. This is achieved by simulating the new greater resolution while rendering it for the supported max resolution, similar to when we watch a Full-HD video on a screen that is not Full-HD.

Scaling the desktop without changing the resolution

Scaling the desktop and simulate/render a new resolution

When using xrandr to “zoom-in” with the previous method, the desktop remain full screen but when we “zoom-out” with for instance xrandr --output screen-name --scale 1.2x1.2 (to get an unsupported resolution) the desktop is not displayed in full screen because this require updating the resolution (to probably a higher unsupported resolution by the screen), we can use a combinaison of --mode, --panning and --scale, xrandr’s parameters to achieve a full screen “zoom-out” scaling (simulate a new resolution), example:

Making xrandr changes persistant

There is a multitude of methods to make xrandr changes persistant, this and this QA have many examples.

Experiments notes

As a side note and experiments result while using SDDM + KDE, and after many tests to achieve a persistant config, I ended up loading a script with ~/.config/autostart (systemsettings5 > Startup… > Autostart), and naming my script 00-scriptname to make it run first.

# 00-scriptname

# Applying the main xrandr suited changes (scaling at x1.15)

xrandr --output eDP1 --mode 1366x768 --panning 1574x886 --scale 1.15226939x1.15364583

# This is where it get odd/complicated, sometimes the screen resolution is not applied correctly or not applied at all... 
# Note that "xrandr --fb" can be used alone to change the screen resolution on a normal situation... 
# Here we will be taking advantage of xrandr's "--fb" feature to make the config appliance stable and works every-time.

# The odd thing here is while re-applying the new resolution 1574x886 with "--fb" nothing happen, but 
# if we use use an unsupported resolution like 1574x884 (vs 1574x886) then xrandr force the resolution 
# to "reset itself" to the configured resolution (1574x886)... 

# In short just re-apply the setting with "--fb" and an unsupported resolution to force a reset.
# ("--fb" can be used alone here without re-applying everything)

#xrandr --fb 1574x884 
xrandr --fb 1574x884 --output eDP1 --mode 1366x768 --panning 1574x886 --scale 1.15226939x1.15364583


Some KDE’s gui tools:systemsettings5 > display, kcmshell5 xserver and kinfocenter.
Links and sources:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12.

Share this post on:

Related posts:

How does Linux's display work?
How to setup a VNC Server on Linux?