Skip to content

Commit 09782d6

Browse files
capezotteCarterLi
authored andcommitted
QT: add qt[56]ct support
1 parent 165aa93 commit 09782d6

File tree

1 file changed

+19
-0
lines changed
  • src/detection/gtk_qt

1 file changed

+19
-0
lines changed

src/detection/gtk_qt/qt.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ static void detectLXQt(FFQtResult* result)
135135
ffParsePropFileConfig("pcmanfm-qt/lxqt/settings.conf", "Wallpaper=", &result->wallpaper);
136136
}
137137

138+
static void detectQtCt(char qver, FFQtResult* result)
139+
{
140+
// qt5ct and qt6ct are technically separate applications, but they're both
141+
// by the same author and qt6ct understands qt5ct in qt6 applications as well.
142+
char file[] = "qtXct/qtXct.conf";
143+
file[2] = file[8] = qver;
144+
ffParsePropFileConfigValues(file, 3, (FFpropquery[]) {
145+
{"style=", &result->widgetStyle},
146+
{"icon_theme=", &result->icons},
147+
// FIXME: on older versions this was hex-encoded binary format
148+
// (See QVariant notes on https://doc.qt.io/qt-5/qsettings.html)
149+
// Thankfully, newer versions use the more common font encoding.
150+
{"general=", &result->font}
151+
});
152+
}
153+
138154
static void detectKvantum(FFQtResult* result)
139155
{
140156
ffParsePropFileConfigValues("Kvantum/kvantum.kvconfig", 1, (FFpropquery[]) {
@@ -158,11 +174,14 @@ const FFQtResult* ffDetectQt(void)
158174
ffStrbufInit(&result.wallpaper);
159175

160176
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
177+
const char *qplatformtheme = getenv("QT_QPA_PLATFORMTHEME");
161178

162179
if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA))
163180
detectPlasma(&result);
164181
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
165182
detectLXQt(&result);
183+
else if(ffStrSet(qplatformtheme) && (ffStrEquals(qplatformtheme, "qt5ct") || ffStrEquals(qplatformtheme, "qt6ct")))
184+
detectQtCt(qplatformtheme[2], &result);
166185

167186
if(ffStrbufEqualS(&result.widgetStyle, "kvantum") || ffStrbufEqualS(&result.widgetStyle, "kvantum-dark"))
168187
{

0 commit comments

Comments
 (0)