From 36b63902921954ea2301f4b2615df3345e4775ed Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 6 Sep 2020 22:08:54 +0200 Subject: [PATCH] Implement NoDisplay= of .desktop entries Closes #9 --- entryprovider.cpp | 13 +++++++++++-- entryprovider.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/entryprovider.cpp b/entryprovider.cpp index eb77b2f..da97b16 100644 --- a/entryprovider.cpp +++ b/entryprovider.cpp @@ -75,6 +75,10 @@ EntryConfig EntryProvider::readFromDesktopFile(const QString &path) } } } + if(key == "nodisplay") + { + result.hidden = args == "true"; + } } return result; } @@ -201,13 +205,18 @@ QVector EntryProvider::readConfig(QStringList paths) if(info.isFile()) { QString suffix = info.suffix(); + EntryConfig entry; if(suffix == "desktop") { - result.append(readFromDesktopFile(path)); + entry = readFromDesktopFile(path); } if(suffix == "qsrun") { - result.append(readFromFile(path)); + entry = readFromFile(path); + } + if(!entry.hidden && entry.name != "") + { + result.append(entry); } } } diff --git a/entryprovider.h b/entryprovider.h index a7ee8ab..49f35bb 100644 --- a/entryprovider.h +++ b/entryprovider.h @@ -17,6 +17,7 @@ class ConfigFormatException : public std::runtime_error class EntryConfig { public: + bool hidden = false; QString key; QString name; QString command;