Implement NoDisplay= of .desktop entries

Closes #9
This commit is contained in:
Albert S. 2020-09-06 22:08:54 +02:00
父節點 5076f044a6
當前提交 36b6390292
共有 2 個檔案被更改,包括 12 行新增2 行删除

查看文件

@ -75,6 +75,10 @@ EntryConfig EntryProvider::readFromDesktopFile(const QString &path)
}
}
}
if(key == "nodisplay")
{
result.hidden = args == "true";
}
}
return result;
}
@ -201,13 +205,18 @@ QVector<EntryConfig> 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);
}
}
}

查看文件

@ -17,6 +17,7 @@ class ConfigFormatException : public std::runtime_error
class EntryConfig
{
public:
bool hidden = false;
QString key;
QString name;
QString command;