6

My laptop has a 15-inch 4k display. Almost everything works perfectly, but some applications don't scale and are too small to use. Some examples: Hipchat, Ardour, Steam, Gimp, etc.

Is there a way for me to solve this? I've seen to use xrandr to set DPI before running the app, but that seems to have no effect (or I'm doing it wrong.)

If I could fix this one problem I'd have everything working perfectly.

Also, I'm using Gnome, but the issue was the same in Unity.

9

As olivierb2 pointed out there is no simple, global way to accomplish this. However, I did find a way to perform window scaling on a per-app basis that works very well, but not for all applications.

I found a script called run_scaled that acts as a front end for xpra, which is like screen for X. It basically sets up a second X server scaled to whatever you choose, runs your app, and then forwards it to your primary display. In order to use it you need to install some deps:

sudo apt-get install xpra winswitch xvfb

Install it:

curl "https://raw.githubusercontent.com/kaueraal/run_scaled/master/run_scaled" > ~/.local/bin/run_scaled
chmod +x ~/.local/bin/run_scaled

And after that on a new shell you run your app like so:

run_scaled someapp

If you test your app(s) that you need scaled and it works you can make it a little more user friendly by copying the script to somewhere in your path and editing the .desktop file for your app so it will launch scaled from your DE.

The downside is that this doesn't work with every app. It seemed to work fine for all of the FOSS apps I tried, but non-free apps like Steam and HipChat didn't work. Not a perfect solution, but it can help in a pinch.

2
  • Is there any way to always run some apps scaled? – Victor Jul 10 '20 at 12:16
  • 1
    @Victor Yes. The way I do it is to (1) write a one-line command that invokes the application using run_scaled the way I want and save this to a shell script (say, in $HOME/bin/.MyAppScript.sh), (2) create a Desktop file (which is a 10-ish line text file, not difficult to learn how to make) that executes the shell script in #1 and save this DEsktop file in $HOME/.local/share/applications, and finally (3) launch from, place in your dock favorites, etc. – Lexible Dec 21 '20 at 18:31
1

Neither Unity nor GNOME supports HiDPI very well yet, but this will improve soon. You can improve useability by just increasing the size of the fonts using to unity-tweak-tool. Open Fonts in the Appearance section, and adjust the Text scaling factor.

Firefox don't take any notice of Unity tweak settings, so you have to configure it manually. Just open it, type about:config in the URL and set parameter layout.css.devPixelsPerPx to the same value that you defined in Fonts.

2
  • Thanks for the input. The HiDPI scaling in both Unity and GNOME seems pretty good actually. Almost every app I use is working fine: Firefox, Chrome, Visual Studio Code, Ryhtmbox, GNOME Shell, all of the built in apps, Evolution, etc. Almost everything is scaling perfectly. So, I don't need a global solution like editing font sizes. I need some way to deal with apps that aren't respecting those settings. Thanks! – Adam Drew Sep 27 '17 at 19:10
  • Unfortunately, I guess there is no global solution yet, and you may need to configure each apps (if possible) to adapt their scaling. – ob2 Sep 27 '17 at 19:17
1

As @Adam Drew recommends, use run_scaled.

On Ubuntu 20.04 LTS install:

sudo apt install xvfb xpra xrandr

Then download run_scaled script from this zip and put it in the /usr/local/bin directory.

Then to launch your program, do for example

run_scaled ./soapui.sh

It works very well on Java Swing apps that don't scale naturally.

0

As @Riki137 said, you could also use run_scaled on 20.04, but xrandr is no longer needed. x11-xserver-utils replaced it

So all you need to do on 20.04 is:

sudo apt -y install xvfb xpra
wget https://raw.githubusercontent.com/kaueraal/run_scaled/master/run_scaled

put it under /usr/local/bin and you are good to go

0

For individual applications that use Qt5 you just need to edit the .desktop file. I will give you an example with a snap application like OpenSCAD.

1.- Go to /var/lib/snapd/desktop/applications

2.- Find your .desktop application, in this case openscad_openscad.desktop

3.- Edit the file (with sudo) and find the line Exec=

4.- In our case the line is: Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/openscad_openscad.desktop /snap/bin/openscad %f

and you have to change it to: Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/openscad_openscad.desktop QT_SCALE_FACTOR=2.5 /snap/bin/openscad %f

QT_SCALE_FACTOR=2.5 was added.

5.- Save your file

6.- Restart your application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.