diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index e0d8fd81a..ed8465781 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -135,6 +135,22 @@ static void detectLXQt(FFQtResult* result) ffParsePropFileConfig("pcmanfm-qt/lxqt/settings.conf", "Wallpaper=", &result->wallpaper); } +static void detectQtCt(char qver, FFQtResult* result) +{ + // qt5ct and qt6ct are technically separate applications, but they're both + // by the same author and qt6ct understands qt5ct in qt6 applications as well. + char file[] = "qtXct/qtXct.conf"; + file[2] = file[8] = qver; + ffParsePropFileConfigValues(file, 3, (FFpropquery[]) { + {"style=", &result->widgetStyle}, + {"icon_theme=", &result->icons}, + // FIXME: on older versions this was hex-encoded binary format + // (See QVariant notes on https://doc.qt.io/qt-5/qsettings.html) + // Thankfully, newer versions use the more common font encoding. + {"general=", &result->font} + }); +} + static void detectKvantum(FFQtResult* result) { ffParsePropFileConfigValues("Kvantum/kvantum.kvconfig", 1, (FFpropquery[]) { @@ -158,11 +174,14 @@ const FFQtResult* ffDetectQt(void) ffStrbufInit(&result.wallpaper); const FFDisplayServerResult* wmde = ffConnectDisplayServer(); + const char *qplatformtheme = getenv("QT_QPA_PLATFORMTHEME"); if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA)) detectPlasma(&result); else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT)) detectLXQt(&result); + else if(ffStrSet(qplatformtheme) && (ffStrEquals(qplatformtheme, "qt5ct") || ffStrEquals(qplatformtheme, "qt6ct"))) + detectQtCt(qplatformtheme[2], &result); if(ffStrbufEqualS(&result.widgetStyle, "kvantum") || ffStrbufEqualS(&result.widgetStyle, "kvantum-dark")) {