Commit 460910bc authored by Julius Künzel's avatar Julius Künzel
Browse files

Fix icon color change in some situations (eg. Appimage)

BUG: 450556
(cherry picked from commit 4ca161d5)
parent 056d1462
Pipeline #187879 skipped
......@@ -181,16 +181,16 @@ int main(int argc, char *argv[])
KConfigGroup grp(config, "unmanaged");
if (!grp.exists()) {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (env.contains(QStringLiteral("XDG_CURRENT_DESKTOP")) && env.value(QStringLiteral("XDG_CURRENT_DESKTOP")).toLower() == QLatin1String("kde")) {
qCDebug(KDENLIVE_LOG) << "KDE Desktop detected, using system icons";
if (env.value(QStringLiteral("XDG_CURRENT_DESKTOP")).toLower() == QLatin1String("kde") && packageType != QStringLiteral("appimage")) {
qCDebug(KDENLIVE_LOG) << "KDE Desktop detected and not Appimage, using system icons";
} else {
// We are not on a KDE desktop, force breeze icon theme
// We are not on a KDE desktop or in an Appimage, force breeze icon theme
// Check if breeze theme is available
QStringList iconThemes = KIconTheme::list();
if (iconThemes.contains(QStringLiteral("breeze"))) {
grp.writeEntry("force_breeze", true);
grp.writeEntry("use_dark_breeze", true);
qCDebug(KDENLIVE_LOG) << "Non KDE Desktop detected, forcing Breeze icon theme";
qCDebug(KDENLIVE_LOG) << "Non KDE Desktop or Appimage detected, forcing Breeze icon theme";
}
}
}
......
......@@ -893,8 +893,14 @@ void MainWindow::slotThemeChanged(const QString &name)
KSharedConfigPtr kconfig = KSharedConfig::openConfig();
KConfigGroup initialGroup(kconfig, "version");
if (initialGroup.exists() && KdenliveSettings::force_breeze() && useDarkIcons != KdenliveSettings::use_dark_breeze()) {
// We need to reload icon theme
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
bool isAppimage = pCore->packageType() == QStringLiteral("appimage");
bool isKDE = env.value(QStringLiteral("XDG_CURRENT_DESKTOP")).toLower() == QLatin1String("kde");
bool forceBreeze = initialGroup.exists() && KdenliveSettings::force_breeze();
if ((!isKDE || isAppimage || forceBreeze) &&
((useDarkIcons && QIcon::themeName() == QStringLiteral("breeze")) || (!useDarkIcons && QIcon::themeName() == QStringLiteral("breeze-dark")))) {
// We need to reload icon theme, on KDE desktops this is not necessary, however for the Appimage it is even on KDE Desktop
// See also https://kate-editor.org/post/2021/2021-03-07-cross-platform-light-dark-themes-and-icons/
QIcon::setThemeName(useDarkIcons ? QStringLiteral("breeze-dark") : QStringLiteral("breeze"));
KdenliveSettings::setUse_dark_breeze(useDarkIcons);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment