You are not logged in.

#1 2019-06-12 08:10:00

LinuxShadow
Member
Registered: 2019-05-04
Posts: 26

i3 - HiDPI setup with multiply monitors

Hi there,

I've got a laptop with an HiDPI monitor (2560x1440; 14").

xdypinfo | grep -B2 resolution

tells me that the monitor has an DPI of 96.

The problem is, I want to scale it to 125%. First, I tried to achieve this with changing the dpi by using

xrandr --dpi

. This however does
not work, as now everything is way to large when I'm connecting my laptop via HDMI to an FHD external monitor. A friend of mine told me than to run this command:

xrandr --output eDP-1 --scale 1.25x1.25 --panning 2560x1440 --mode 2560x1440

Afterwards my desktop is rendered only on a part of my screen. Another problem I can see with this is, that when applying a proper scale after connecting to an 4k monitor, I always have to manually reset the scale when connecting back to an FHD monitor and applying it again when connecting to an HiDPI screen.

I'm currently using LightDM as my login manager and i3 as my desktop/window manager with X.Org. Note however, that I do not want to scale LightDM, I only want to apply a scale to my i3 session.

Is there any way how I can manage this setup?

LinuxShadow

Last edited by LinuxShadow (2019-06-13 20:52:55)

Offline

#2 2019-06-12 11:07:31

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: i3 - HiDPI setup with multiply monitors

Please remove the tag from the subject and ensure to have read up https://wiki.archlinux.org/index.php/HiDPI and esp. http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/
You can use https://aur.archlinux.org/packages/x-on-resize/ to automize stuff

Offline

#3 2019-06-13 21:24:21

LinuxShadow
Member
Registered: 2019-05-04
Posts: 26

Re: i3 - HiDPI setup with multiply monitors

seth wrote:

Please remove the tag from the subject and ensure to have read up https://wiki.archlinux.org/index.php/HiDPI and esp. http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/
You can use https://aur.archlinux.org/packages/x-on-resize/ to automize stuff

I've read up the article about HiDPI on the Arch Wiki and it states that for i3 the dpi has to be changed within ~/.Xresources, thought as far as my understanding goes, this will set the dpi globally for
all monitors. The section about "Multiply Displays" seems to cover my usecase somewhat? but not entirely. As soon as I've got time, I'll look into the last two links (thought this " Mixed DPI and the X Window System"
looks promising). wink

Offline

#4 2019-06-15 22:35:54

LinuxShadow
Member
Registered: 2019-05-04
Posts: 26

Re: i3 - HiDPI setup with multiply monitors

seth wrote:

Please remove the tag from the subject and ensure to have read up https://wiki.archlinux.org/index.php/HiDPI and esp. http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/
You can use https://aur.archlinux.org/packages/x-on-resize/ to automize stuff

Ok, according to those articles, I should scale my primary monitor (the internal one) by changing the Xft.dpi setting within ~/.Xresources, execute xrdb -merge ~/.Xresources and then set the resolution of my external monitors to the one of my HiDPI monitor and scale those down or up to their native resolution (depending on whether those have a higher or lower resolution than the internal resolution), am I correct?
Changing the Xft.dpi from 96 to 120 (125%) and executing the xrdb -merge command, then logging out and logging in again (using LightDM) causes my desktop (i3) to be rendered only on a part of my screen.
I'm also looking into this tool, thought at first I want to know how this all works when doing it the manual way.

Offline

#5 2019-06-16 05:39:38

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: i3 - HiDPI setup with multiply monitors

A re-login has a ginormous chance of restarting the X11 server, loosing all xrdb settings.
https://wiki.archlinux.org/index.php/X_resources

Setting the dpi via xrandr is still "required" (assuming it's for some reason not initially correct)

You won't get around scaling one of the outputs because X11 supports only one logical DPI.
Clients *can* determine the physical DPI and their screen position and adapt their rendering, but that possibility is underused and afaik not used dynamically (when you reposition windows) at all.

The "broken" rendering of i3 is likely because it missed a resize of the root window, typically because you're forking xrandr or i3 calls (or because i3 ignores randr events) - ensure to run xrandr before i3

Offline

#6 2019-06-16 12:59:14

LinuxShadow
Member
Registered: 2019-05-04
Posts: 26

Re: i3 - HiDPI setup with multiply monitors

seth wrote:

A re-login has a ginormous chance of restarting the X11 server, loosing all xrdb settings.
https://wiki.archlinux.org/index.php/X_resources

Ah, ok. Thought wouldn't "xrdb -merge ~/.Xresources" automatically merge the settings with the current one in order to not loose the settings when X11 restarts?

seth wrote:

Setting the dpi via xrandr is still "required" (assuming it's for some reason not initially correct)

I don't know if its correct or not. My understanding here is that X11 always reports an DPI of 96.
My laptop monitor (copied from notebookcheck.net): 14 inch 16:9, 2560 x 1440 pixel 210 PPI

seth wrote:

You won't get around scaling one of the outputs because X11 supports only one logical DPI.
Clients *can* determine the physical DPI and their screen position and adapt their rendering, but that possibility is underused and afaik not used dynamically (when you reposition windows) at all.

Thought I would have to scale all outputs. Everything on my internal monitor should be rendered 25% larger while the external monitors: it depends, 4k = 50% larger, WQHD = 25% larger, FHD = normal size.
And my assumption here is: to scale everything on my internal montior in order for it to appear 25% larger I would have to change the DPI within ~/.Xresources from 96 to 120.

seth wrote:

The "broken" rendering of i3 is likely because it missed a resize of the root window, typically because you're forking xrandr or i3 calls (or because i3 ignores randr events) - ensure to run xrandr before i3

With LightDM as the login manager, where should I call the xrandr command? And I guess I should execute it with "xrandr --dpi 120" then?

Thought it's interesting to see how much needs to be done for some simple scaling (coming from environments where I can set the scale factor for each monitor individually to be 100%, 125% etc. without having to know anything about dpi).

Last edited by LinuxShadow (2019-06-16 12:59:50)

Offline

#7 2019-06-16 14:39:34

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: i3 - HiDPI setup with multiply monitors

The rdb is volatile on the server. You'll have to reload the file everytime the X11 server starts (eg. in some init script)

X11 reports whatever resolution is configured, check "xdpyinfo | grep resolution" for the logical DPI

And my assumption here is: to scale everything on my internal montior in order for it to appear 25% larger I would have to change the DPI within ~/.Xresources from 96 to 120.

Yes, though the more relevant setting is probably "xrandr --dpi 120" (or if you're using the nvidia blob, you can also issue the DPI in the Xorg config/let)
That's *not* scaling the output, "xrandr … --scale …" will cause the output to be rendered at a different size than the outputs resolution and then stretched/squeezed into the output (and as an unfortunate side-effect, the display can look blurry)

It's actually not  much, but if you're in search for a config GUI and therefore a pretty static system layout (ie. DM & DE pre-chosen for you), you're using the wrong distro.
For lightm use this config: https://wiki.archlinux.org/index.php/Li … ng_monitor

Edit: of course not literally, but apply the relevant xrandr calls in that config.

Last edited by seth (2019-06-16 14:40:17)

Offline

#8 2019-06-19 09:13:52

LinuxShadow
Member
Registered: 2019-05-04
Posts: 26

Re: i3 - HiDPI setup with multiply monitors

seth wrote:

The rdb is volatile on the server. You'll have to reload the file everytime the X11 server starts (eg. in some init script)

X11 reports whatever resolution is configured, check "xdpyinfo | grep resolution" for the logical DPI

And my assumption here is: to scale everything on my internal montior in order for it to appear 25% larger I would have to change the DPI within ~/.Xresources from 96 to 120.

Yes, though the more relevant setting is probably "xrandr --dpi 120" (or if you're using the nvidia blob, you can also issue the DPI in the Xorg config/let)
That's *not* scaling the output, "xrandr … --scale …" will cause the output to be rendered at a different size than the outputs resolution and then stretched/squeezed into the output (and as an unfortunate side-effect, the display can look blurry)

It's actually not  much, but if you're in search for a config GUI and therefore a pretty static system layout (ie. DM & DE pre-chosen for you), you're using the wrong distro.
For lightm use this config: https://wiki.archlinux.org/index.php/Li … ng_monitor

Edit: of course not literally, but apply the relevant xrandr calls in that config.

Well, all the config GUIs I know of only support 100% or 200% scaling, but not 125% like Windows does (basically: they only support integer-scaling instead of fractal-scaling). Thought the reason I'm on arch is because I want to understand how those things work in the background. wink
Meaning I should call (I suppose within ~/.xinitrc) "xrandr --scale" instead of "xrand --dpi" in order to scale my desktop?

If I understood you and the links you send me correctly:
1. change Xft.dpi setting within ~/.Xresources
2. use "xrand --scale" within "~/.xinitrc"
3. use "xrdb -merge ~/.Xresources" within "~/.xinitrc"
4. Scale down for example an external FHD monitor from WQHD: "xrandr --output DP-1 --scale-from 2560x1440"

Correct?

Offline

#9 2019-06-19 10:26:17

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: i3 - HiDPI setup with multiply monitors

You meant "xrand[r] --dpi …"?
If DP-1 has a physical resolution of 2560x1440, your call will be idempotent…

xinitrc is not necessarily executed by your session or DM, but you can also put this into your i3 config ("exec" options)

The integer scaling will probably relate to environments parsed by the toolkits (Qt & gtk3) and happen on top of or aside any dpi settings.
The big difference compared to windows™ is that the linux GUI is far more fragmented - several toolkits and desktop environments from various vendors implementing lots of NIH stuff™ turn hidpi into quite some mess :-(

Offline

#10 2019-08-14 15:36:15

agaskins
Member
Registered: 2012-04-17
Posts: 5

Re: i3 - HiDPI setup with multiply monitors

Just FYI, I'm having issues running xrdb -merge [or -load/-override] from .xinitrc. I'm loading a secondary .Xresources-hidpi file with just my Xft.dpi (and a catch-all *.dpi for things like 'rofi' to pick up). Normally, on the running system -merge or -override works fine (apparently -merge also overrides values, as well as resorts the list, so I just always use -merge). The problem is that it seems i3 is reloading the standard .Xresources file and overriding my HiDPI changes... or at least that what it seems like is happening. If I run the same commands from terminal (in i3) or via the i3 config it works fine, but this is not ideal, as my whole purpose for the .Xresources-hidpi file is that I only have one HiDPI capable device and use the same came config files with over a half dozen machines. I guess I'll end up having to do some scripting for system-specific config bits, but it just feels wrong. Anyways, just something to watch out for, as it caused me a bit of of a headache before I figured out what i3 was doing.

btw I do use the set_from_resource option a few times in my i3 config (to get  color code values), so I should really disable that and see if it still causes this issue. I can't test this right at the moment but I'll report back if this changes anything!

Last edited by agaskins (2019-08-14 15:40:30)

Offline

Board footer

Powered by FluxBB