You are not logged in.

#1 2022-08-23 11:17:28

aks
Member
Registered: 2020-03-17
Posts: 21

[Solved][xfce] What should be proper way to set correct DPI for laptop

I have read the wiki at Arch Wiki HiDPI

But I am still confused if making the DPI change to 156 at Settings Manager > Appearance > Fonts > Custom DPI setting is enough or something at Xorg also needs to be changed?

Please note that I cannot use 2x windows scaling as that goes way too big. I want to set DPI to whatever is "right" for this display. Please provide some guidance as to what all changes are required when using Arch with Xfce DE.

Laptop screen as per

xrandr

is

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1920x1080     60.05*+  60.01    59.97    59.96    59.93    40.03

Actual laptop screen when measured using tape comes around 313mm x 176mm. The slight difference from xrandr may be due to the measuring tape quality. The laptop is advertised as 157ppi on internet and e-commerce sites.

Attaching few more outputs:

xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    1920x1080 pixels (508x285 millimeters)
  resolution:    96x96 dots per inch
grep DPI /var/log/Xorg.0.log
[    14.988] (==) modeset(0): DPI set to (96, 96)
xrdb -query
Xft.antialias:	1
Xft.hinting:	0
Xft.hintstyle:	hintnone
Xft.rgba:	none
Xft.dpi:	156
Xcursor.theme:	
Xcursor.size:	0
Xcursor.theme_core:

Last edited by aks (2022-08-23 18:52:18)

Offline

#2 2022-08-23 11:33:54

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,824

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

"xrandr --dpi 156"
If you've any nvidia GPU, the driver interprets a corresponding Xorg device option.
Otherwise you'll have to run that at the very beginning of the session script (since everything else is only affected afterwards) or use the Xorg parameter.

The physical DPI seems rather around ~158dpi according to the xrandr dimensions, but your measuring tape gets you at 156 wink

Offline

#3 2022-08-23 12:09:26

aks
Member
Registered: 2020-03-17
Posts: 21

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

Thanks Seth!

I have few follow up questions on using "xrandr --dpi 156". I have only AMD iGPU (whatever comes default with Ryzen 5625U).

  1. Which command can I use to confirm if the DPI has in fact changed to said value?

  2. Shall I untick the custom DPI Change checkbox in xfce settings?

  3. What would be the good way to run it? Somewhere mentioning in lightdm conf file (I guess this is the default login manager in xfce) or in Settings Manager -> Session and Startup -> Application Autostart

By using Xorg parameter, do you mean this wiki section? Here I need to set correct dimensions and that would automatically fix up the DPI?

Offline

#4 2022-08-23 12:30:23

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,824

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

1. xdpyinfo | grep resolution
2. I've no idea about xfce settings, sorry.
3. depends on where you want it - the lightdm script might not extend to/get overridden by the session, though.

https://wiki.archlinux.org/title/Xorg#D … ze_and_DPI

The DPI of the X server can be set with the -dpi command line option.

https://github.com/canonical/lightdm/bl … m.conf#L91 might work

Offline

#5 2022-08-23 14:52:29

aks
Member
Registered: 2020-03-17
Posts: 21

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

I was referring to this portion from the wiki:

Section "Monitor"
    Identifier             "DVI-D-0"
    DisplaySize             286 179    # In millimeters
EndSection

Anyway, I didn't try directly mentioning the dimension and I tried commenting out that line mentioned in your link and adding "-dpi 156" but it didn't work.

I also tried https://gist.github.com/ciarand/8592193 with following code but it didn't work:

#!/usr/bin/env bash
xrandr --dpi 156

The above file was executed as per lightdm logs but didn't change the output of xdpyinfo.


Then I added the line "xrandr --dpi 156" to Settings Manager -> Session and Startup -> Application Autostart and it worked.
Whether I check or uncheck the "Custom DPI Change" checkbox in xfce font settings doesn't make a difference to dpi, so I assume this setting was a high level override which was working somehow.

Now, the output is like below:

xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    1920x1080 pixels (312x175 millimeters)
  resolution:    156x157 dots per inch

Though the below log still says 96dpi:

grep DPI /var/log/Xorg.0.log
[   877.156] (==) modeset(0): DPI set to (96, 96)

Do you have any idea about this value? May be it's set before auto-start happens and can be ignored? If can be ignored, I can we can mark this as Solved.

Just an additional doubt? If in future, if an HDMI screen is added which has a different DPI, does Xorg / Xrandr allows setting different DPI's for different output screens?

Offline

#6 2022-08-23 18:30:33

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,824

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

96 used to be / is the default DPI (iirc the server had a patch to dynamically calculate the DPI but that was reverted?) - depending on where this appears in the log (early on) you can ignore it
In any event xdpyinfo always reflects the current value on the server (and is therefore the relevant data)

does Xorg / Xrandr allows setting different DPI's for different output screens?

Nope. https://wiki.archlinux.org/title/HiDPI# … e_displays

Mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#7 2022-08-23 18:46:42

aks
Member
Registered: 2020-03-17
Posts: 21

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

Thanks a lot, closing smile

Last edited by aks (2022-08-23 18:47:05)

Offline

#8 2022-08-23 20:59:49

aks
Member
Registered: 2020-03-17
Posts: 21

Re: [Solved][xfce] What should be proper way to set correct DPI for laptop

I would like to add that if I remove the script which I made with help of github gist mentioned earlier, xfce somehow loads with wrong dpi (xdpyinfo is still correct) and making any font changes reflect the correct DPI thereafter.
Most likely autostart happens much later and xfce gui has already loaded and doesn't check for new dpi.

So, to get things working both script and autostart are needed even though both are same commands.

Offline

Board footer

Powered by FluxBB