Since it’s a bit hard to find out which part of all the “How do I do HiDPI on a Linux/BSD box with X11?"-lore you actually need to get a usable setup, I’ve collected all the things that I needed for getting that set up on my Dell XPS 13 7390.
Some of the sections below mention manipulating the file
~/.Xdefaults. If you modify the file, the changes won’t become effective immediately. You can either reload the file with
xrdb -load ~/.Xdefaults or just restart your X11 session. If you only do the manual reload, already running applications won’t be affected.
Decide which DPI you want content to be rendered at. The default DPI that X11 assumes is 96, so if you want the content on your screen to be twice as large, set the DPI to 192 by adding:
The selected DPI should be an even multiple of 96 (which is the Low-DPI value that X11 uses by default), otherwise you may get weird scaling artifacts such as fuzzy fonts.
~/.Xsession or shell profile to get proper scaling in QT applications like Virtualbox.
The dirty trick to get multiple screens with different DPI working at appropriate resolutions (similar to MacOS) is to set the DPI of all screens to the highest and scale screens with lower DPI so that they display their content at the right size.
In my example, I have two screens:
The trick now is to render the content of the external display on a frame buffer twice as large as the display and “zooming out” the display so that it can display the complete frame buffer:
xrandr --output DP-1 --scale 2x2 --mode 1440x900 --fb 2880x1800
The other display needs to be moved to the side a bit so that they fit next to each other nicely:
xrandr --output eDP-1 --pos 2880x0
This is only effective for the current session. I just stuck these commands in a shell script that I start when I connect the external screen.
The biggest benefit of a HiDPI display is the ability to use larger font sizes and get smoother rendering of text. Some applications are not smart enough to derive appropriate font sizes from the value of the
Xft.dpi value in the X resources, so you may need to adjust fonts to just use larger sizes. In my setup, this mostly applies to applications using “classic” X11 libraries for rendering text, such as Acme and
~/.config/gtk-3.0/settings.ini and restart GTK applications.
These are things like DWM, Acme, …