I've got a setup where I'm always logging in to the same account (Centrify managed on the same network), but some of the systems have 24" 1080p (1920x1080) monitor(s) and others have 27" 4K (3840x2160) monitors. The default Gnome scaling factor is roughly correct for the 1080p monitors, but leaves things unreadably tiny on the 4K monitors.

I can manually fix it each time I switch machines by launching the Tweaks tool, going to the Font tab, and setting the Scaling Factor to 1.38 (for 4K) or 0.98 (for 1080p) to make it readable, and Gnome updates to use the new scaling factor immediately.

I'm trying to script this to occur automatically in my .bashrc (we have a weird setup where .bashrc is always run, even for the login shell; I just test for being in a non-ssh, non-interactive login shell so it doesn't run except in the login shell) so I don't need to do anything manual when I switch machines, so I wrote two .Xresources files, one with:

Xft.dpi:         132

and the other with:

Xft.dpi:         94

and based on which machine I'm logging into, I run:

xrdb -merge ~/path/to/appropriate/.Xresources

to apply the correct dpi setting for that machine. But while some other settings in the .Xresources file (omitted) take effect immediately (the applications are closed on login, so they load the correct settings when I launch them) it doesn't change the setting for my existing login's Gnome shell UII; it only applies when I log out and back in again, and I'd rather not have to log in, out and back in again each time I switch machines (that's worse than the manual update in Tweaks).

So my question is:

Is there any programmatic way to do one of:

1. Tell Gnome to reload config from the xrdb settings (xrdb -query -all clearly shows the change was made, it just isn't being applied)?

2. Directly tell Gnome to use a new scaling factor in the same way the Tweaks tool does it?

3. (If I have an XY problem) A cleaner way to apply a custom DPI in some other way?

1 Answer 1


Turns out the answer is #2; the gsettings command line tool can directly tell Gnome to use a specific scaling factor (and it updates the xrdb state to match automatically). I can remove the Xft.dpi setting from my various .Xresources files and just run:

gsettings set org.gnome.desktop.interface text-scaling-factor 1.375  # Equivalent to xrdb dpi of 132

for the 4K machines, and:

gsettings set org.gnome.desktop.interface text-scaling-factor 0.97916666666667  # Probably more precision than necessary to get exact xrdb dpi of 94

Hat tip to the similar questions feature! I wrote this question thinking I'd need to wait for an answer, but by the time I finished writing it, the similar questions dropdown ended up headed by KDE dynamic high-dpi text scaling, which, while not a duplicate, happens to give the answer to my Gnome problem in the question. I self-answered just so there's a dedicated question/answer for this problem rather than an answer hidden in a loosely related question.

  • 1
    Side-note: While I did self-answer, if there are other ways to do this nicely (addressing #1 or #3), I'd love (and up-vote and/or accept) any answer that provided an even moderately nice alternative. Commented Dec 3, 2021 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .