Commit 0a5f0368 authored by Bharadwaj Raju's avatar Bharadwaj Raju 📚 Committed by Nate Graham
Browse files

applets/taskmanager: Always show album art for single non-browser windows


(cherry picked from commit 3f6839d3)
parent d5f74abb
......@@ -228,8 +228,11 @@ ColumnLayout {
Image {
id: albumArtImage
// also Image.Loading to prevent loading thumbnails just because the album art takes a split second to load
// don't show album art if window title doesn't include media title (eg we're in a different browser tab)
readonly property bool available: (status === Image.Ready || status === Image.Loading) && generateTitle().includes(track)
// if this is a group tooltip, we check if window title and track match, to allow distinguishing the different windows
// if this app is a browser, we also check the title, so album art is not shown when the user is on some other tab
// in all other cases we can safely show the album art without checking the title
readonly property bool available: (status === Image.Ready || status === Image.Loading)
&& (!(isGroup || backend.applicationCategories(launcherUrl).includes("WebBrowser")) || generateTitle().includes(track))
anchors.fill: hoverHandler
// Indent by one pixel to make sure we never cover up the entire highlight
......
......@@ -141,6 +141,20 @@ QUrl Backend::tryDecodeApplicationsUrl(const QUrl &launcherUrl)
return launcherUrl;
}
QStringList Backend::applicationCategories(const QUrl &launcherUrl)
{
const QUrl desktopEntryUrl = tryDecodeApplicationsUrl(launcherUrl);
if (!desktopEntryUrl.isValid() || !desktopEntryUrl.isLocalFile() || !KDesktopFile::isDesktopFile(desktopEntryUrl.toLocalFile())) {
return QStringList();
}
KDesktopFile desktopFile(desktopEntryUrl.toLocalFile());
// Since we can't have dynamic jump list actions, at least add the user's "Places" for file managers.
return desktopFile.desktopGroup().readXdgListEntry(QStringLiteral("Categories"));
}
QVariantList Backend::jumpListActions(const QUrl &launcherUrl, QObject *parent)
{
QVariantList actions;
......@@ -249,11 +263,9 @@ QVariantList Backend::placesActions(const QUrl &launcherUrl, bool showAllPlaces,
}
QVariantList actions;
KDesktopFile desktopFile(desktopEntryUrl.toLocalFile());
// Since we can't have dynamic jump list actions, at least add the user's "Places" for file managers.
const QStringList &categories = desktopFile.desktopGroup().readXdgListEntry(QStringLiteral("Categories"));
if (!categories.contains(QLatin1String("FileManager"))) {
if (!applicationCategories(launcherUrl).contains(QLatin1String("FileManager"))) {
return actions;
}
......
......@@ -77,6 +77,7 @@ public:
Q_INVOKABLE qint64 parentPid(qint64 pid) const;
static QUrl tryDecodeApplicationsUrl(const QUrl &launcherUrl);
Q_INVOKABLE static QStringList applicationCategories(const QUrl &launcherUrl);
public Q_SLOTS:
void presentWindows(const QVariant &winIds);
......
Markdown is supported
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