You are not logged in.

#1 2019-11-18 10:19:19

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

I have been struggling with the setup of GNOME on my laptop with 13" screen (1920x1080) and external 28" monitor (3840x2160) due to proper scaling.

The laptop screen and external monitor are usually used alternately, so I'm either working at my desk with the laptop lid closed or on the move. For the 28" monitor a fractional scaling of 125% is required, because 100% is way too small and 200% way too big.

After trying to make it work with GNOME on Wayland with org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" for fractional scaling enabled, I finally gave up on that idea because it makes apps running on Xwayland (like ungoogled-chromium) all blurry (besides the problem of broken VA-API support).

I am now running on GNOME in Xorg session and followed the instruction from the HiDPI Wiki Page by zooming in with GNOME Settings (200%) and zooming out with xrandr (--scale 1.25x1.25). That way everything is just rendered perfectly.

My problem is now that I don't know how to incorporate that xrandr setting to stick on reboot/logout and laptop lid open/close or external monitor connect/disconnect (for either single screen or dual-screen use).

In my current scenario I had the laptop lid closed, so the external 28" monitor was in use in single screen mode, I have applied the xrandr setting, then set the scaling to 200% in GNOME Settings and everything looked as desired. Then I opened the laptop lid and the display on the 28" monitor reverted to a scaling of 100% (with the xrand setting still applied, so the outcome was smaller than 100%). I switched back to 200% in GNOME Settings and it looks correctly again, but trying to switch to multi-monitor-mode didn't work (so the laptop lid is open, the laptop screen is switched off and in GNOME Settings it's telling something like "Changes can not be applied - This could be because of hardware restrictions" (translated from German)).

Any ideas?

Offline

#2 2019-11-18 10:34:21

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

Some more info:

I tried to reboot with the laptop screen open/closed and external monitor connected/disconnected as well as performing these step with the system running, but always the same, it switches between the laptop screen and the external monitor, but dual-screen doesn't work (""Changes can not be applied - This could be because of hardware restrictions").

Maybe I need a customized xorg.conf? Can anybody help with this?

The other observation is that after a reboot with the laptop lid closed the external monitor starts with the 200% scaling from GNOME Settings, but when I apply the xrandr command (xrandr --output DP-1 --scale 1.25x1.25) the GNOME Scaling Setting reverts to 100% and I have to change that setting to 200% again to get to the desired result.

Can this be done with a customized xorg.conf or a script with the two commands (xrandr and gsettings) and how could this be automated for reboot, laptop lid open/close and external monitor connect/disconnect?

Damned, that all looks even more complicated and over my head now... sad

Offline

#3 2019-11-18 12:01:56

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

So obviously that kind of scaling to work properly in dual screen mode requires some more xrandr magic (this is about the virtual workspace size, which is why GNOME Settings didn't let me switch to dual screen mode in previous attempts), which is becoming overly complicated, so I just stick to using the two screens alternately.

To reach the desired results by commandline, the commands have to be executed in the following order:

gsettings set org.gnome.desktop.interface scaling-factor 2
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"
xrandr --output DP-1 --scale 1.25x1.25

Now the simplest method would be to put this into a bash script and create a keyboard shortcut for its execution.

If someone has a better idea on how to automate this or if there is a better method to get to this result, please tell.

Offline

#4 2019-11-18 14:45:54

LordChaos73
Member
From: .nl
Registered: 2008-11-11
Posts: 183

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

I use Plasma myself, but I tried to do this in Gnome the other day using a live Ubuntu 19.10 image.
I did apply fractional scaling under X11 first by the way, and Gnome was able to maintain a scale of 175% procent on my laptop panel and a scale of 100% on my external monitor. I hope this is helpful.

Offline

#5 2019-11-18 15:25:25

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

LordChaos73 wrote:

I use Plasma myself, but I tried to do this in Gnome the other day using a live Ubuntu 19.10 image.
I did apply fractional scaling under X11 first by the way, and Gnome was able to maintain a scale of 175% procent on my laptop panel and a scale of 100% on my external monitor. I hope this is helpful.

Thanks for your feedback, but unfortunately that doesn't help because Ubuntu has patched Mutter to incorporate the experimental feature [‘x11-randr-fractional-scaling’], which means that one is not available on Arch Linux.

That patch can be found here and it would be interesting to give it a try, but I'm not capable to create an AUR package for this.

I'm also not sure if that patch alone does the trick, because when doing the fractional scaling on Wayland everything looks good except apps that run on Xwayland, which was the reason to give up on the idea of sticking to GNOME on Wayland.

On GNOME in a Xorg session it's a two-part fix, the scaling in GNOME Settings (zoom-in) + the xrandr scaling (zoom-out).

As shown in my previous postings it's working fine so far when performing these steps manually (except the additional xrandr magic required to make dual-screen use possible), so now I'm looking for a more elegant way to either automate the procedure or by using a keyboard shortcut to trigger a toggle-script.

Offline

#6 2019-11-18 16:48:31

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

I'm not qualified to create an AUR package (yet), but there is already a solution coming from a Manjaro user for incorporating that patch for [‘x11-randr-fractional-scaling’]:

mutter-x11-scaling

I have just compiled and tried it, and although I could not see any errors and the fractional scaling showed up in GNOME Settings after enabling it, it didn't work as expected.

Fractional scaling of the interface seemed to work, but not the window scaling, so after selecting 125% or 150% the interface became bigger as expected but the windows became tiny, much like when selecting 100% in GNOME Setting and applying xrandr --output DP-1 --scale 1.25x1.25

Either I did something wrong or something is missing. But I'm really just stumbling around here, I'm clearly lacking the knowledge for this kind of manipulation.

Last edited by Master One (2019-11-18 16:49:28)

Offline

#7 2019-11-20 09:41:41

LordChaos73
Member
From: .nl
Registered: 2008-11-11
Posts: 183

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

Maybe you should give Plasma a try, I also use my laptop panel (14" - 1440p) or my external monitor (27" - 1440p) ) exclusively, at least when I work from home.
For the laptop panel I use a global scaling of 2x but I force the fonts to 168dpi. For the external monitor I use a scaling of 1x and a font dpi of 108. This works pretty well, although switching back and forth is obviously a bit time consuming as I have to switch between settings. See this thread also.

Offline

#8 2019-11-20 14:46:26

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: HiDPI setup of GNOME in Xorg session: How to incorporate xrandr?

@LordChaos73 already tried, but Plasma / KDE makes different kind of problems. I have long thought about it, the overall HiDPI scaling and font rendering is worse on Plasma / KDE which is why I decided to go for GNOME. It also doesn't make sense for me to go for a cumbersome solution in which I have to change more than one setting when switching between the external monitor and the laptop screen.

I'm currently pretty much out of option. I could not get the mutter-x11-scaling to work as supposed to, my current attempts with manually setting the fractional scaling with gesetttings + xrandr on GNOME in Xorg session is too cumbersome (doesn't even survive a suspend/resume cycle), so if ungoogled-chromium-ozone is going to happen, I think my best option will be to return to GNOME on Wayland (although there are other annoyances with it, like broken VAAPI support and strange clipboard problems).

Offline

Board footer

Powered by FluxBB