Who is setting the Xresource Xft.dpi

dpihigh-dpix11xfce

We recently received new laptops with a 2160p display. I received it with Ubuntu 16.04 installed with the Unity desktop. I've since installed and use Xfce 4, but kept the Unity greeter (because pretty).

I fully expected to see font scaling issues with the high-DPI display, but something has set the Xresource Xft.dpi to 192, rather than the typical 96. This is picked up by nearly all applications, making the internal display mostly usable. 10 out of 10, right?

Well, no, because I can't figure out where this is being set. Xfce's appearance panel claims the DPI is 96. dconf variables where they exist also show 96. xdpyinfo also says it's 96. Xorg.0.log has one message regarding DPI, and says it's 96. lightdm.conf (configuration file for the Unity greeter) shows no attempt to change it. And xrandr is reporting an identity transformation matrix (no scaling).

My suspicion is that either GNOME or the Unity greeter are the culprit, since the greeter starts out rendered in Flyspeck 3, but then rescales itself after a moment. But I can't figure out where it was told to do this, or how it persists to the desktop session.

My goal is to plug in an external 1080p display and tweak the DPI such that both displays are vaguely legible. But I can't effectively do that if I'm fighting with something else trying to do it behind my back.

All clues welcome.

System Info

  • Ubuntu 16.04.3
  • unity 7.4.0+16.04.20160906-0ubuntu1
  • xorg 1:7.7+13ubuntu3
  • xfce 4.12.2

Best Answer

Apparently Gnome-settings-daemon changes Xft.dpi.

I execute this as /usr/lib/gsd-xsettings from ~/.xinitrc. I don't use Gnome but I need to configure various GTK apps to e.g. not blink the cursor, and that's why I run the daemon. (I could also edit ~/.config/gtk-3.0/settings.ini)

I just changed that so I run xrdb after starting the settings daemon.

I'm probably not understanding some of the terminology of the question but maybe this will be useful. I imagine that one of the pieces of software you are running is executing gsd-xsettings.

Here is the piece of code which changes the Xft.dpi property:

$ grep -n Xft.dpi gnome-settings-daemon/plugins/xsettings/gsd-xsettings-manager.c -2
852-        g_debug("xft_settings_set_xresources: orig res '%s'", add_string->str);
853-
854:        update_property (add_string, "Xft.dpi",
855-                                g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->scaled_dpi / 1024.0));
856-        update_property (add_string, "Xft.antialias",

The top of that file explains at great length why the software defaults to 96 DPI. Presumably I could configure something to set an XSETTINGS value for "Xft/DPI", and then GTK would be using the value I prefer, rather than overriding the value I configured in ~/.Xdefaults with its "default" of 96.

Related Question