Commit 664e5ed3 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

MPRIS2: Fallback icon for Firefox

Supports MPRIS2, but not completely so need the icon name here.  There
may be multiple possibilities (also for Chrome), so return a list of
names and use the first one found in ToggleToolButton::setIndicatorIcon().
parent 2c33f44f
......@@ -369,15 +369,15 @@ static QString getIconNameFromPlayerId(const QString &id)
if (id.startsWith(QLatin1String("tomahawk"))) return ("tomahawk");
if (id.startsWith(QLatin1String("clementine"))) return ("application-x-clementine");
// Partially supports MPRIS2 from version 75 onwards.
// Some systems seem to have really old icon names.
if (id.startsWith(QLatin1String("firefox"))) return ("firefox;netscape");
// Surprisingly, claims to support MPRIS2 but does not fully.
// The installed icon name may vary depending on whether the application
// is really Chrome or Chromium.
if (id.startsWith(QLatin1String("chrome")) || id.startsWith(QLatin1String("chromium")))
if (QIcon::hasThemeIcon("chromium-browser")) return ("chromium-browser");
if (QIcon::hasThemeIcon("chrome-browser")) return ("chrome-browser");
if (QIcon::hasThemeIcon("google-chrome")) return ("google-chrome");
return ("chromium-browser;chrome-browser;google-chrome");
// Uses QtWebEngine which is based on Chromium, so as above...
if (id.startsWith(QLatin1String("akregator"))) return ("akregator");
......@@ -137,7 +137,15 @@ void ToggleToolButton::setActive(bool active)
void ToggleToolButton::setIndicatorIcon(const QString &iconName, QWidget *label, bool small)
const auto icon = QIcon::fromTheme(iconName);
const QStringList iconNames = iconName.split(';');
QIcon icon;
for (const auto &name : iconNames)
if (!QIcon::hasThemeIcon(name)) continue;
icon = QIcon::fromTheme(name);
if (icon.isNull())
qCWarning(KMIX_LOG) << "Could not get icon for" << iconName;
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