Skip to content

Commit

Permalink
Fix applying dark scheme when QT_STYLE_OVERRIDE is set
Browse files Browse the repository at this point in the history
When QT_STYLE_OVERRIDE is set to something like "Adwaita-dark" it breaks
the theme since it doesn't apply the corresponding color scheme.
We should check if we should force dark color sheme similarly to how
it's done in GnomeSettings::styleNames().

Signed-off-by: Pavel Artsishevsky <[email protected]>
  • Loading branch information
polter-rnd committed Oct 31, 2022
1 parent e379a91 commit 0f87acb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/hintprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ void HintProvider::setTheme(const QString &theme, GnomeSettings::Appearance appe
{
m_gtkTheme = theme;
qCDebug(QGnomePlatformHintProvider) << "GTK theme: " << m_gtkTheme;

m_appearance = appearance;
if (qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE")) {
QString styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
if (styleOverride.toLower().contains("-dark") || styleOverride.toLower().endsWith("inverse"))
m_appearance = GnomeSettings::PreferDark;
}
qCDebug(QGnomePlatformHintProvider) << "Prefer dark theme: " << (appearance == GnomeSettings::PreferDark ? "yes" : "no");
}

Expand Down

0 comments on commit 0f87acb

Please sign in to comment.