Workarounds for apps that don't support HiDPI

Having just got a 4K monitor - Wow! Text looks so much clearer! :smiley: Unfortunately (as of 2018), some applications do not scale well so they appear really tiny. This topic is to offer workarounds to get applications to work. This assumes you are comfortable with the terminal.

To make changes persistent, use the Main Menu tool to modify the application's launcher.

General Tips

  • For GTK+ applications, check to see if it has a GTK3 build.
  • GTK2 applications have no chance of scaling by themselves, such as GIMP, etc.
  • Some apps can be scaled using an environment variable or parameter.
  • To tell what the toolkit of an application is, take a look at its dependencies:
    apt-cache show [package]

How do I enable HiDPI for the MATE Desktop?

Starting from 18.04, you'll be able to turn on HiDPI from MATE Tweak.

What is discussed here can also apply to other distributions - such as Arch, where MATE is the desktop environment.

Spotify

Spotify doesn't auto-detect scaling properly, but fear not, you can manually specify this.

spotify --force-device-scale-factor=2

Steam

Update to the beta version of the Steam client, as this supports HiDPI as of 25th January 2018.

Qt Applications

Like VirtualBox, Git Cola and KeePassXC.

QT_SCREEN_SCALE_FACTORS=2 <application>

To set this permanently for all Qt apps, add this to /etc/environment (as sudo) or ~/.bash_aliases (in your home directory):

export QT_SCREEN_SCALE_FACTORS=2

GTK3 Applications

This shouldn't be necessary when turning on HiDPI in MATE Tweak. For 2x scaling for 2160p (4K), set the environment variables like so:

export GDK_SCALE=2
export GDK_DPI_SCALE=0.5

Wine Applications

  1. Open winecfg
  2. Under the "Graphics" tab, set the DPI to 192.
  3. Save. The Wine applications will scale accordingly on next launch.

Older games

If the game was built around a time where HiDPI was not a thing, like during the 2000s, then you may be out of luck. Unless there is a modification, the best approach is to set the resolution to 1080p or lower.

If this needs to be automated as part of a script, use xrandr:

#!/bin/bash
xrandr -s 1920x1080
/path/to/executable
xrandr -s 3840x2160

Scaling any application

If all else fails, there is a project that can scale anything by spawning a new session using X.org (the display server).

The downsides is that the scaled app may appear or feel a little blurry to the rest of the desktop.
Media keys may not work (like for audio players); themes & mouse pointers can be inconsistent and 3D acceleration may suffer in performance.

Instructions
  1. Download the run_scaled.sh script.

  2. Install its dependencies and move the script system-wide:

     chmod +x run_scaled.sh
     sudo mv ./run_scaled.sh /usr/bin/run_scaled
     sudo apt install xvfb xpra xrandr
    
  3. To use, simply prepend run_scaled to your command. There are optional parameters to specify scale.

     run_scaled <application>
    
5 Likes

This might be helpful for Java apps: https://askubuntu.com/questions/526484/fix-scaling-of-java-based-applications-for-a-high-dpi-screen

Thanks for the tips!

I use a few QT programs (KMyMoney, KeepassXC, and Manuskript). Another way to get them to scale involves general settings. I put two files in my home directory. I think only one of them is needed, but I don't know which one. Anyway, I didn't have either of them after a fresh install of Ubuntu MATE 18.04.2, so I made them.

The first is called ".profile" and the second, ".bash_profile" . And each contains the line:
export QT_AUTO_SCREEN_SCALE_FACTOR=1

When I rebooted, KMyMoney, KeepassXC, and Manuskript all were properly scaled. I guess it would work on other QT applications...?

Also, I do have some old Windows programs (three of which are 16-bit, and two are 32-bit). I went to a terminal and typed in:
winecfg

This opens the wine Configuration dialogue box. I went to the Graphics tab and tried setting Screen resolution dpi to 256. This worked okay for my text-and-window based 32-bit program, but it failed to do anything for my other 32-bit program, which was a graphics-heavy game. It also did nothing but screw up some of the text on the 16-bit programs, so I just set the dpi to 128 and left it. It's hardly a tragedy, as I almost never use those old Windows programs.

I wonder, though, if anyone out there knows what might make it possible to up-scale old Windows programs (like from the 16-bit era).

Got any idea how I could scaleThunderbird? I'm tired of hitting CTRL+++ in order to see my emails. If not, no big deal. I'm not using HiDPI, have a 1920x1080 laptop display and would prefer some directions in using xpra if that might be the way to solve my difficulty.

Thanks.

You can use Firefox / Thunderbird about:config editor, search for the key layout.css.devPixelsPerPx and change the value from -1.0 to 1.25 (or find the one that works better for you).

2 Likes

I used this - https://support.mozilla.org/en-US/kb/config-editor to access the editor and modify that value to 1.4. Thanks davemux86

2 Likes