Freedesktop needs to define a way to get/set the default icon theme
Submitted by Jerome Leclanche
Assigned to Jerome Leclanche
Description
Currently there is no way to get the default icon theme from system files. This is an issue when using a DE that is not based on gnome or kde.
This leads to the following code in Qt, which breaks outside of gnome/kde and results in an unmodifiable icon theme:
/* the default icon theme name for QIcon::fromTheme. */ QString QGuiPlatformPlugin::systemIconThemeName() { QString result; #ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_GNOME) { result = QString::fromLatin1("gnome"); #ifndef QT_NO_STYLE_GTK result = QGtkStylePrivate::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result); #endif } else if (X11->desktopEnvironment == DE_KDE) { result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Icons")); result = settings.value(QLatin1String("Theme"), result).toString(); } #endif return result; }
An implementation (don't remember which one) creates a theme called "default" and an index.theme symlinked to the chosen default theme. Issue with adopting that is the lack of control over multiple defaults.
What I propose: A defaults.list file which specifies the preferred themes. Example file:
[Theme] Name=oxygen
[Theme] Name=gnome OnlyShowIn=Gnome
[Theme] Name=tango DontShowIn=KDE
[Theme] Name=mygenerictheme
[Theme] Name=myfallbacktheme
Keys are listed in order of priority. If a theme cannot be found or does not match the current configuration, the next one is chosen, until a theme is found to exist. hicolor is always the last fallback.
The described file specifies that the default global theme is oxygen. If oxygen cannot be found, in gnome only, we check if the "gnome" icon theme exists and use it if it does. If we still don't have a theme, if we are not in KDE we try the tango theme. If we still don't have a theme, we try "mygenerictheme". If we still don't have a theme, we try "myfallbacktheme".
Finally, if none of those themes work, we default to hicolor.
unrelated: in the "Directory layout" section, there should be a mention of whether svgz files are allowed or not.