Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active February 9, 2023 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/d3c72e8af3dc4f7b089385c0bbf86a78 to your computer and use it in GitHub Desktop.
Save cellularmitosis/d3c72e8af3dc4f7b089385c0bbf86a78 to your computer and use it in GitHub Desktop.
Correcting Linux DPI (PPI)

Blog 2020/7/6

<- previous | index | next ->

Correcting Linux DPI (PPI)

For whatever reason, Linux (Debian Buster, XFCE) doesn't get my monitor's DPI correct. The symptom is that all text seems smaller than it should be.

(the other symptom is a sore wrist from hitting control-plus in chrome all day long!)

First, let's see what Linux thinks my DPI is:

$ xdpyinfo | grep -B 2 resolution
screen #0:
  dimensions:    2560x1440 pixels (677x381 millimeters)
  resolution:    96x96 dots per inch

I broke out a tape measure and whoa, that's way off! I measure 21 3/4" width, or about 552mm. That's more like 117 DPI.

But wait, Linux already knows this!!!:

$ xrandr | grep -w connected
DP-0 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 553mm x 311mm

47f6du

Regardless, the solution is simple: create a ~/.Xresources file, like so:

$ cat ~/.Xresources 
Xft.dpi: 117

Log out, log back in.

Things should look "normal" now, and you should see:

$ xdpyinfo | grep -B 2 resolution
screen #0:
  dimensions:    2560x1440 pixels (551x312 millimeters)
  resolution:    118x117 dots per inch
@nnop
Copy link

nnop commented Feb 9, 2023

Why use the term DPI which is actually PPI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment