Skip to content

High DPI issue: 96 DPI is too small, 128 DPI is too big, 112 DPI is perfect, but Chromium and Electron programs don't support it

Hello!

I have a small 1080p monitor. I'm using the KDE System Settings interface to change the "Fonts DPI" value as suggested by the ArchWiki.

​

The default DPI setting (96 DPI) is a bit too small: I struggle at reading text. 128 DPI is a bit too large: everything becomes way too big and too few windows fit into my monitor.

112 DPI is a perfect value I could find after a bit of experimenting.

​

KDE and GTK applications supports all the three DPI settings and I'm most comfortable at 112.

Chromium at 112 DPI behaves exactly like at 96 DPI. It shows larger content at 128 DPI, so DPI scaling works, but not fully. I could verify the issue by taking screenshots and comparing them.

This problem also affects Electron programs, and I rely on one heavily.

​

Is this a known issue? Is it possible to fix it?

25 points13 comments
Open on Reddit
About this post
Posted
Archived
Score
25 · 100% up
Kind
Text
ID
fcagfi

Author

7
posts
8
comments
0
media
View profile

13 comments

yep. Any chrome based app can be scaled with

--force-device-scale-factor=1.3 example from my PC for 2560x1440 monitor

20 points

It seems like it's working. Using --force-device-scale-factor=1.16 gives me what I want. Thank you.

It's very weird though. It looks like Chrome based applications support Xft.dpi too, just like the GTK applications do, but only for 96 DPI (scale factor 1) and for 128 DPI (scale factor 1.333). Nothing in between. While with --force-device-scale-factor it's possible to use values in between too.

​

Would you know whether it's possible to set the scale factor value in an environment variable or configuration file? Having to add it to the command line of every Chrome-based application one by one sounds stupid.

6 points

i dont know a way to set that globally but

for google-chrome you can create a file at ~/.config/chrome-flags.conf and add it there

same for chromium but different name ~/.config/chromium-flags.conf

for other electron apps change the .desktop file at /usr/share/applications/

change the line Exec=/usr/bin/SOME-ELECTRON-APP --force-device-scale-factor=1.16 %U

but be aware the .desktop files will be overwritten if you update the app from your distro you need to set it again or write a script that modifies those files so you dont do it manually every time

Also take a look to https://wiki.archlinux.org/index.php/HiDPI a lot of things here for dpi

1 points

I'm confused since Linux/X.org DPI has been dynamic since the age of CRT monitors.

`xdpyinfo` would give the exact size of display in mm precision and calculate the actual, real DPI of your display from that, and that's what all programs should use so text is always the same real size regardless of display size and resolution.

Whereas Windows just used a fixed DPI value whether or not it matched your display and every display would show things at a different size.

Frustrating to hear that this is still a problem today... sorry for not offering a solution

2 points

I'm confused since Linux/X.org DPI has been dynamic since the age of CRT monitors.

I'm not sure. According to the ArchWiki most program use xrdb's Xft.dpi. It mentions using the value from xdpyinfo, but it makes it sound like that method is deprecated:

Some programs may still interpret the DPI given by the X server (most interpret X Resources, though, directly or indirectly). Older versions of i3 (before 2017) and Chromium (before 2017) used to do this.

​

In any case, it doesn't matter to me why these choices were made: I'm happy to manually set Xft.dpi to my favorite value.

The problem is that Chromium doesn't support any value between 97 and 127. I guess it wouldn't support those values even if it computed the DPI automatically from xdpyinfo.

2 points

that's a sad state of affairs

my monitor is older (16:10 1920x1200) so I have no hands on experience with 4K yet, didn't expect it to be that bad

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.