HiDPI Settings for X11 on OpenBSD
Running an OpenBSD desktop on a HiDPI screen isn’t too complicated. At my home office I use a 5k 34" screen with an 21:9 aspect ratio. If you don’t change anything, X11 will display everything super small. Fixing the DPI requires a couple of changes.
Tell X11 the correct monitor size, take the values from here in millimeter (mm) and put it in /etc/X11/xorg.conf.d/monitor.conf
:
Section "Monitor"
Identifier "DP1"
DisplaySize 796 336
EndSection
My Identifier is called DP1
for first display port, yours might be different. Check the output of xrandr
for the correct id.
You need to restart (at least X11) for this to take effect.
Create/modify your .Xresources
file:
% cat .Xresources
Xft.dpi: 163
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
The correct setting for Xft.dpi
might vary on your screen.
The Arch Wiki advises to use a multiple of 96
where 192
represents a 200%
scaling.
For me, this seems not to have any effect and I am happy with my native setting of 163
, which is also shown in xdpyinfo
:
% xdpyinfo | grep -B 2 resolution
screen #0:
dimensions: 5120x2160 pixels (796x336 millimeters)
resolution: 163x163 dots per inch
This fixed the HiDPI scaling for me, a lot more parameters are described in the Arch Wiki, however I didn’t need any of them so far.