3

I'm testing Ubuntu Bionic, GNOME, elementary OS, KDE, Xfce 4.13 (the GTK3 version, all apps have been ported to GTK3).

All distros support hidpi across frameworks: when I launch Google Chrome/Firefox/etc. (GTK 3), VirtualBox (Qt 5), or Spotify (Electron) some component in the DE detects that my screen is 4K and does the right thing so that the app is scaled at 2x.

With the exception of Xfce. In Xfce, third-party apps don't work well, expecially Qt and Electron apps which are never launched at the correct scaling.

​Xfce 4.13 has a "scaling" option that you can use to specify that you want everything scaled to x2. However, even if I do that, Qt and Electron apps do not pick up the setting. I also tried using gsettings to set the "GNOME" setting in addition to Xfce's, to no avail. Qt and Electron apps still look bad, while on GNOME they look great out-of-the-box.

My Question is: how do Ubuntu, elementary and to a certain extent KDE make apps using different frameworks all scale correctly?

Of course, I know how to launch Qt apps at the correct scaling manually, but I'm wondering what makes this process so much easier on distros other than Xfce.

Is there a package that I can install from another distro that will make Xfce behave "correctly", so that if I launch a GTK3, Qt, or Electron app they get scaled correctly? Is it the launcher than passes some variables, or is it a lower-level component?

1 Answer 1

2
+50

Unfortunately there is no such a global option to set. Those distributions are setting various variables for you.

A lot of applications are taking the Xft.dpi setting from ~/.Xresources into account (That's the only option I've set but I barely use GUI applications)

Since Qt 5.6, Qt 5 applications can be instructed to honor screen DPI by exporting

export QT_AUTO_SCREEN_SCALE_FACTOR=1

If that doesn't work try

export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=2

GDK 3 (GTK+ 3) can be scaled with

export GDK_SCALE=2

electron applications are difficult to handle on linux [1] [2]. They respect the text-scaling-factor option from GNOME for example [3].
Here you have no choice but to use --force-device-scale-factor=1.5 as an argument.

Well documented Arch Linux HiDPI wiki page for further reading

3
  • Hi, thanks for your answer. I too have found HiDPI wiki page to be the best source for this info, and use it as a reference to launch apps manually. However, I was looking into something permanent and programmatical. So, if distros set those variables for you, what is the package for instance in Ubuntu Bionic which does it? Is it directly the installer? Do they write to your home folder, so should I investigate there?
    – nkkollaw
    Aug 31, 2018 at 13:29
  • 1
    @nbrogi: Try putting the values that you've found to work in ~/.bashrc, ~/.xinitrc, /etc/profile, or (if my brief google about XFCE returned sane results) ~/.config/xfce4/xinitrc.
    – i336_
    Sep 4, 2018 at 13:48
  • Nice, i336. ~/.config/xfce4/xinitrc looks promising.
    – nkkollaw
    Sep 4, 2018 at 22:05

You must log in to answer this question.

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