https://bugs.kde.org/show_bug.cgi?id=528187

            Bug ID: 528187
           Summary: AppImage ignores qt5ct/QT_QPA_PLATFORMTHEME: AppRun
                    forces gtk2 platformtheme and oxygen style
    Classification: Applications
           Product: subtitlecomposer
      Version First 0.8.2
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 197943
  --> https://bugs.kde.org/attachment.cgi?id=197943&action=edit
Before: light theme, no qt5ct line. After (XDG_CURRENT_DESKTOP=KDE workaround):
dark theme, qt5ct plugin loaded.

DESCRIPTION:
The AppImage ignores QT_QPA_PLATFORMTHEME=qt5ct (and QT_STYLE_OVERRIDE) on
desktops other than MATE, Ubuntu GNOME and KDE (XFCE in my case). The app
always starts with the Oxygen style and a light palette, even though the
AppImage bundles libqt5ct.so and libqt5ct-style.so.

Cause: AppRun selects the theme through a case "$XDG_CURRENT_DESKTOP" block.
Any desktop not listed falls into the "*" branch:

    *)
        exec "${app}" -platformtheme gtk2 -style=oxygen "$@"
        ;;

Command-line arguments take precedence over the QT_QPA_PLATFORMTHEME and
QT_STYLE_OVERRIDE environment variables, so the user's Qt theme configuration
is never applied.

STEPS TO REPRODUCE:
1. Use a desktop that is not KDE/MATE/Ubuntu GNOME (e.g. XFCE) with qt5ct
configured (Fusion style + a dark color scheme). Other Qt5 apps follow it
correctly.
2. Run: QT_QPA_PLATFORMTHEME=qt5ct ./subtitlecomposer.AppImage
3. Optionally run with QT_DEBUG_PLUGINS=1: the bundled libqt5ct.so is found,
but the app still starts with Oxygen.

OBSERVED RESULT:
The app starts with the Oxygen style and a light palette, ignoring qt5ct.

EXPECTED RESULT:
If the user explicitly sets QT_QPA_PLATFORMTHEME and/or QT_STYLE_OVERRIDE,
AppRun should respect them and not force -platformtheme/-style on the command
line.

SOFTWARE/OS VERSIONS:
Operating System: Xubuntu 26.04.1 LTS (Resolute Raccoon) x86_64
Kernel: Linux 7.0.0-42-generic
Desktop: Xfce 4.20 (Xfwm4, X11)
KDE Plasma Version: N/A (Xfce 4.20, not running Plasma)
KDE Frameworks Version: 5.116.0 (bundled in the AppImage)
Qt Version: 5.15.19 (bundled in the AppImage)
GPU/driver: NVIDIA GeForce GTX 1050 Ti, driver 580.178.04

ADDITIONAL INFORMATION:
Workaround: bypass AppRun after --appimage-extract:

    cd squashfs-root
    LD_LIBRARY_PATH=$PWD/usr/lib QT_PLUGIN_PATH=$PWD/usr/plugins \
    QT_QPA_PLATFORMTHEME=qt5ct ./usr/bin/subtitlecomposer -style qt5ct-style

Terminal output: "qt5ct: using qt5ct plugin", and the dark Fusion theme is
applied correctly.

Another workaround without extracting (tested, works): 
XDG_CURRENT_DESKTOP=KDE QT_QPA_PLATFORMTHEME=qt5ct ./subtitlecomposer.AppImage
The "KDE" branch of the case does not pass -platformtheme/-style, so the app
starts with the dark Fusion theme from qt5ct.

Suggested fix: apply the fallback only when the user has not set a theme, e.g.

    *)
        if [ -n "$QT_QPA_PLATFORMTHEME" ] || [ -n "$QT_STYLE_OVERRIDE" ]; then
            exec "${app}" "$@"
        else
            exec "${app}" -platformtheme gtk2 -style=oxygen "$@"
        fi
        ;;

(the same check could be applied to the MATE and Ubuntu GNOME branches).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to