[wiki] Set All Qt app's to use your GTK+ theme & font settings:

wiki
#1

13-Mar-2018: Updated content & method.

Copied from the “Classic” old forum.

Here’s a wiki page that shows how to sort out the question of how to make Qt app’s use your GTK+ DE/WM’s settings.

Please post any problems re. this topic here in this thread?

7 Likes

Why isn't Manjaro Settings respecting the default theme?
Re: [wiki] Set All Qt app’s to use your GTK+ theme & font settings
#2

Thanks for the Howto! Unfortunately, it only works partially for me. For some reason the variable set in /etc/environment is not properly read.

[photon@Thinkpad-X200T ~]$ echo $QT_QPA_PLATFORMTHEME
qt5ct
[photon@Thinkpad-X200T ~]$ qt5ct 
Configuration path: /home/photon/.config/qt5ct/
Shared QSS path: /usr/share/qt5ct/qss/
# graphical message: The QT_QPA_PLATFORMTHEME environment variable is not set correctly 
[photon@Thinkpad-X200T ~]$ export QT_QPA_PLATFORMTHEME=qt5ct
[photon@Thinkpad-X200T ~]$ qt5ct
qt5ct: using qt5ct plugin
Configuration path: /home/photon/.config/qt5ct/
Shared QSS path: /usr/share/qt5ct/qss/
# application starts

So echo returns the correct value but qt5ct doesn’t recognize it. After setting the value by hand, qt5ct recognizes it (in the given virtual terminal). Also QT apps only follow the settings made in qt5ct if started in a virtual terminal with the variable set manually.

0 Likes

#3

@Photon I dunno? That method is still working for me on my custom built Net-install Openbox system.

Perhaps there is more info’ on the ArchWiki? (There usually is.)

0 Likes

#4

You are right. :slight_smile:

I put

export QT_QPA_PLATFORMTHEME=qt5ct

into ~/.xprofile (probably /etc/xprofile is better, but there is only one user here and that’s me) and this made it work.

1 Like

#5

@Photon Good to hear. :slight_smile:

1 Like

#6

You should change font settings in qt5ct for qt apps because qt apps many times ignoring font and lcdfilter.

0 Likes

#7

I updated the wiki page contents/method (relatively minor, though it may make all the difference.

I’m on Artix, so I get updates a bit sooner than you here. You may not need to change anything (yet). :wink:

https://wiki.manjaro.org/index.php?title=Set_all_Qt_app’s_to_use_GTK%2B_font_%26_theme_settings

0 Likes

#8

Are you sure of your modifications?

From man environment :

The /etc/environment file specifies the environment variables to be set. The file must consist of simple NAME=VALUE pairs on separate lines.

0 Likes

VLC 3 gives no option for GTK theme
#9

Yep, I’m sure in that it works. :slight_smile:

1 Like

#10

Heres a gathering of info, which leads me to believe the wiki should be edited again.

Global configuration files of your shell, initializes variables and runs scripts.

So export should only be used in things like /etc/profile

Instead in /etc/environment we would use just

QT_QPA_PLATFORMTHEME=qt5ct
QT_AUTO_SCREEN_SCALE_FACTOR=0

The difference is also important, because

/etc/profile initializes variables for login shells only

and also

The dbus daemon and the user instance of systemd do not inherit any of the environment variables set in places like ~/.bashrc etc. This means that, for example, dbus activated programs like Gnome Files will not use them by default

So.
With as systemd is default in manjaro if we want to do this per-user, no root required, and fully recognized we could issue the variables somehwere like
~/.config/environment.d/qtusegtk.conf
In which case we would again use the name=value (no export) convention.

https://wiki.archlinux.org/index.php/Environment_variable
https://wiki.archlinux.org/index.php/Systemd/User#Environment_variables
https://jlk.fjfi.cvut.cz/arch/manpages/man/environment.d.5

1 Like

#11

@cscs Please change the wiki to suit systemd better? I said in the wiki &/or in the wiki support page that this works fine for Artix (no systemd) & that it may be bit soon upgrade wise for Manjaro (when I wrote the wiki page as Artix is usually ahead of Manjaro in its upgrades from Arch) & that any specific changes that need to be made to suit Manjaro (if any) will be made when discovered. :slight_smile:

So go for it cscs (I only know what I know, & what I can test myself). :slight_smile:

0 Likes

#12

I still wanted your go-ahead :wink:

1 Like

#13

@handy could you convert your first post to wiki so it can be edited, please?
Or copy (this is wikified) and paste the following just to have the info included here as well.
I just tested how easy/difficult is copying from wiki.manjaro to the forum wiki/tutorial topics.
I find it pretty easy. I have also created a kind-of TOC to try unifying the two sites. Am I moving too fast? :thinking:


This fix makes your Qt app’s use your GTK+ theme (colours & such) & your chosen font settings.


How do you do it?

  1. Install qt5ct
  2. Set environment variables in /etc/environment and add the following lines:
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_AUTO_SCREEN_SCALE_FACTOR=0
  1. Restart the system
  2. Start qt5ct
  3. In the first tab Appearance choose Standard Dialogs: default (some people get crashes if they choose GTK3)

Because we used /etc/environment to set the environment variables back in step 2), after you reboot, both the user & root accounts will be able to benefit from these changes.

(If you find that certain widget styles are missing, you can see if qt5-styleplugins brings a fix for you.)

0 Likes

#14

@petsam I learned some years back, not to have two pages with the wiki info’ on it. If only the wiki has the info’ then only the wiki has to be maintained. That is the long & the short of it.

You’ll find that all of the support pages that I have connected to the wiki page, only give a heads up of what’s on the wiki page & thereafter any changes get notified (one way or the other) in the support page, so that people in the forum know that there has been a change in the wiki.

Does that make sense?

0 Likes

#15

More than perfect and I more than absolutely agree!
What about…

It’s on the same spirit, IMHO.

0 Likes

#16

If every wiki page had a Support page here in the forum, then any changes to the wiki, or errors, updates needed… posts could be put into that Support page here in the forum. That way the community knows about updates, & the wiki maintainers know about the need to create an update.

Having such support pages imho is the ideal interface between the forum & the wiki.

The wiki needs to be used; to use the wiki, you go there & use it. Diffusing the wiki with the same info’ in more than one place doesn’t make sense to me.

I don’t really understand what you are doing by making an index of the wiki on the forum. Are you going to have a copy of the wiki index here on the forum where people select a heading/link & go to the wiki?

If so, that sounds like a lot of work. Wouldn’t a link to the wiki on the forum be enough?

0 Likes

#17

I set environment with this wiki but I have some qt scaling problems (vlc, and other qt based apps). I find solution. Wiki need just a little bit change. When I change this line
export QT_QPA_PLATFORMTHEME=qt5ct
to this
export QT_QPA_PLATFORMTHEME=“qt5ct”
my qt scaling problems solved :wink: Please change this wiki page
Best regards

0 Likes

#18

I wonder if this was the actual reason, but since it doesn’t hurt, I added the quotation marks in the wiki. :slight_smile:

0 Likes

#19

For the record, my instance has no quotation marks.

0 Likes

#20

Configuration of Qt5 apps under environments other than KDE Plasma

Unlike Qt4, Qt5 doesn’t ship a qtconfig utility to configure fonts, icons or styles. Instead, it will try to use the settings from the running DE. In KDE Plasma or GNOME this works well, but in other less popular DEs or WM it can lead to missing icons in Qt5 applications. One way to solve this is to fake the running desktop environment by setting XDG_CURRENT_DESKTOP=KDE or GNOME, and then using the corresponding configuration application to set the desired icon set.

Another solution is provided by the qt5ct package, which provides a DE independent Qt5 QPA and a configuration utility. After installing the package, run qt5ct to set an icon theme, and set the environment variable QT_QPA_PLATFORMTHEME=“qt5ct” so that the settings are picked up by Qt applications. Alternatively, use --platformtheme qt5ct as argument to the Qt5 application.

To automatically set QT_QPA_PLATFORMTHEME for user session, add the following line to ~/.xprofile.

[ “$XDG_CURRENT_DESKTOP” = “KDE” ] || [ “$XDG_CURRENT_DESKTOP” = “GNOME” ] || export QT_QPA_PLATFORMTHEME=“qt5ct”

0 Likes