Featured image of post Linux Desktop on Dual Monitor with Different DPI

Linux Desktop on Dual Monitor with Different DPI

Very simple, just render everything at the highest DPI and then compress it for presentation on a low-resolution screen. With this approach, the low DPI screen will be “supersampled” and may be slightly blurry, but the loss is not significant compared to the approach of high-resolution screens presenting low-resolution images.

For example, here I have two 27-inch monitors, connected to DP1 and HDMI2 respectively (you can use xrandr to check). DP1 is a Dell 2K monitor (2560x1440), and HDMI 2 is a Lenovo FHD monitor (1920x1080). In terms of screen positioning, FHD is on the left and 2K is on the right.

First, you need to disable the window manager’s built-in multi-screen manager (such as KDE’s Kscreen2), if there is one. Then, in ~/.xinitrc or any equivalent X11 startup script, add the following commands:

xrandr \
  --output HDMI2 \
    --panning 2400x1350 \ # Left screen render resolution
    --pos 0x0 \           # Top left position of the left screen
    --scale 1.25x1.25 \   # Scaling factor of the left screen
  --output DP1 \
    --panning 2560x1440 \ # Right screen render resolution
    --pos 2560x0 \        # Top left position of the right screen
  --fb 4960x1440          # Size of the entire framebuffer

Some of the values here are my parameters. Different multi-monitor configurations may require a slight calculation on your own, which is not difficult.

After completion, restart X server to complete the adjustment. If all goes well, the two screens should work relatively normally. The effect is shown in the picture below:


comments powered by Disqus
Except where otherwise noted, content on this blog is licensed under CC-BY 2.0.
Built with Hugo
Theme Stack designed by Jimmy