Getting 1.5x scaling on Xorg isn't always very straight-forward. Here's how I got it working
Getting fractional scaling right in Xorg is tricky, but possible. The solution that works for me comes in 2 parts.
Enlarge UI and text by 200% — Use Xresources + GDK + QT env vars to scale everything by 200%. You can't adjust this without restarting apps. This 200% shouldn't be changed; for fractional scaling, we will scale down the display instead in the next step.
Scale your display down as needed — Use xrandr to scale things down by 75%, or whatever ratio you like. This can be adjusted on the fly, and can be applied per-display.
In the example above, you'll have a 150% screen scale (200% × 75% = 150%).
There are 3 solutions to changing UI scaling in Xorg. Each one affects different things, so we'll need to combine them appropriately. These things can either scale text (ie, increase font sizes) or scale UI elements (ie, increase "pixels" in margins and paddings).
Apps | Xresources | GDK env vars | QT env vars |
---|---|---|---|
Firefox & Chrome | UI & Text | UI & Text | |
GTK apps (eg, Thunar) | Text | UI & Text | |
Regular Xorg apps (eg, urxvt) | Text | ||
QT apps (eg, Dolphin, Krita) | Text | UI & Text |
We'll update the Xresources config file to tackle Xresources
,
and we'll set some environment variables to tackle GDK
and QT
scaling.
Place this in ~/.profile
. These variables will take effect when you log in.
Place this in ~/.Xresources
. These will take effect on your next log in.
These two things combined will make all your apps display 2x as large. If you want to have a scaling of 200%, then congrats—you're done! If you'd like to have fractional scaling (eg, 150% or 175%), then move onto the next section.
Set Xft.dpi
in your Xresources to scale up fonts in almost all Xorg apps.
This scales fonts up by 2x. The default is 96dpi, so 192
is 2x that.
This affects fonts only, not UI elements. It only scales fonts. In effect, apps (eg, Nautilus, Thunar) will look like they have huge text, but UI elements will not scale up.
Firefox and Chromium will look okay with just this. UI elements will be scaled along just fine.
If you do this on the fly (echo "Xft.dpi: 192" | xrdb -merge -
), it will
affect apps that will be started after that change.
Scale GTK apps using some environment variables.
This makes GTK apps look okay when combined with Xresources above.
GDK_SCALE
will enlarge both text and UI elements by 2x, effectively making
text up 4x now when combined with Xresources above.
GDK_DPI_SCALE
will reduce text elements by 2x.
Using GDK_SCALE
alone, without the Xresources above or GDK_DPI_SCALE
setting, will scale GDK apps properly. However, not GTK apps will be left
behind, eg, urvxt.
Scale QT apps using some environment variables.
This manually forces QT scaling by 2x. By setting QT_AUTO_SCREEN_SET_FACTOR
,
we disable QT's automatic DPI adjustments.
This affects QT apps.
After enlarging your UI by 2x, you can use xrandr
to scale it down to your desired size. This example below gets you an effective scale of 175%. (2 / 1.75 = ~1.14)
Note that not all versions of Xorg might support this. For older versions, the tool x11-fractional-display-scaling can help.