Using qt5ct for Qt and GTK applications uniformity

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
glitchdot
Posts: 9
Joined: Sun Mar 24, 2019 7:56 pm

Using qt5ct for Qt and GTK applications uniformity

#1 Post by glitchdot »

This is a small guide how to configure qt5ct, so you can have better control of Qt apps themes.

Theme uniformity in MX Linux is good out of box, but for further configuration of the theme settings, one could use qt5ct, which can be found in the repository.
In my case I wanted to change icons used in qt apps, but after launching qt5ct I got warning that application is not configured properly.
Image

To do that QP_QTA_PLATFORTHEME should be set to qt5ct. In MX Linux this environment value is set in /etc/X11/Xsession.d/56xfce4-qtconfig like this:

Code: Select all

# Set QT variables to only pass to gtk2 Xfce environment
# /etc/X11/Xsession.d/56xfce4-qtconfig
#
BASESTARTUP=$(basename "$STARTUP" | cut -d\  -f1)
if [ "$BASESTARTUP" = x-session-manager ]; then
    BASESTARTUP=$(basename $(readlink /etc/alternatives/x-session-manager))
fi
case "$BASESTARTUP" in
  xfce4-session|startxfce4)
      #set qt environment variables to follow gtk2
      export QT_QPA_PLATFORMTHEME=gtk2
      export QT_PLATFORMTHEME=gtk2
      export QT_PLATFORM_PLUGIN=gtk2
      if command -v xfconf-query >/dev/null; then
         export QT_SCALE_FACTOR=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor 2>/dev/null)
         [ -z "${QT_SCALE_FACTOR}" ] && unset QT_SCALE_FACTOR
      fi
      ;;
esac
For qt5ct to work properly "export QT_QPA_PLATFORMTHEME=gtk2" should be changed to "export QT_QPA_PLATFORMTHEME=qt5ct" and reboot.

Return to “Tips & Tricks by users (not for help)”