Starting QT apps via thunar differs from starting them in other ways

Hi,

after the recent update of my office desktop computer, I now experience a strange behavior.

My desktop settings are 4K resolution with 2x scaling and adwaita dark theme applied.

When I start any QT program (kate, kile, qpdfview, etc.) via thunar (it doesn’t matter wether left- or right-click), it starts with the light theme and a tiny 1x scaling.

The same programs display themselfs in the correct manner if I start them via Start-Menu, the terminal or even via a different file browser (PCManFM).

Where can I look to determine why and how thunar starts them differently?

Thank you all in advance for your help

Cheers
Jens

PS: thunar Version: 4.18.6, PCManFM Version: 1.3.2

I have neither of these programs, but i checked which of my stuff is dependent on qt5-base. So i just double clicked /usr/bin/audacious and it looks normal (Dark and large enough). I am however on FullHD with 120 DPI font setting, the scaling through the “Display” settings was too large and buggy for me. But that cannot reset the theme anyways.

I was going to mention QT styling under a GTK desktop … but if it is sometimes working that may not be the issue. link anyways…
https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications

Edited:

Ach 30 min later I have a MUCH better solution. At least writing about it made me think … It is as I suspected, Thunar is started “too early” to pick up all the desktop settings (such as scale).

All you need to do is

$ pkill thunar

and then start it again. It will now run with all your current environment respected. Which is to say, it will now run all programs the same as if you run them from the command line, menu, etc.

You might add this code line to your .bashrc.


First reply:
I have exactly the same problem, and a similar lack of solution… It seems to me the problem lies with Thunar being set to run very early in the session, before all the environment variables used in every other application have been set. (For example: Thunar’s definition of $PATH does not include $HOME/.local/bin.)

Here is a workaround, but it needs to be done for each affected application. For example, for Kate, I created a file called “big-kate” in $HOME/.local/bin:

#!/bin/bash
QT_SCALE_FACTOR=1.5 kate "$@"

Then in Thunar, find a file of a type you want to open in (big) Kate, right-click, Open with Other Application, at the bottom expand “Use a custom command” and type in “/home/username/.local/bin/big-kate %f” (without the quotes, and replace username by your user name - $USER will not work here).

You could make it the default application, although Thunar will only use it for the specific file type you set it up for. Looking in Settings->Default Applications there are about a million file types you would need to do this for. On the other hand, you will from now on see “big-kate %f” as an Open-with option for most text file types, so get used to right-clicking.

Workaround 2: avoiding making any changes to Thunar’s file associations and make everything that was Kate now be big-kate, across the entire system including Thunar:

$ cd /usr/bin
$ sudo mv kate kate~bak
$ sudo ln -s /home/YOUR-USENAME/.local/bin/big-kate kate

and change file big-kate to point to kate~bak

#!/bin/bash
QT_SCALE_FACTOR=1.5 kate~bak "$@"

WARNING - this will break when Kate is updated!! And possibly it will break the update process. This is a convenient but extremely dangerous workaround.

Anybody got a safer bet?

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.