core/desktopentry: mask entries with priority less than hidden entry

This commit is contained in:
bbedward 2025-09-18 09:33:55 -04:00 committed by outfoxxed
parent e10747addd
commit 8d2a2d3dd2
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 18 additions and 2 deletions

View file

@ -11,3 +11,4 @@
- Fixed a crash when running out of disk space to write log files.
- Fixed a rare crash when disconnecting a monitor.
- Fixed build issues preventing cross compilation from working.
- Fixed dekstop entries with lower priority than a hidden entry not being hidden.

View file

@ -108,7 +108,6 @@ ParsedDesktopEntryData DesktopEntry::parseText(const QString& id, const QString&
auto finishCategory = [&data, &groupName, &entries]() {
if (groupName == "Desktop Entry") {
if (entries.value("Type").second != "Application") return;
if (entries.value("Hidden").second == "true") return;
for (const auto& [key, pair]: entries.asKeyValueRange()) {
auto& [_, value] = pair;
@ -118,6 +117,7 @@ ParsedDesktopEntryData DesktopEntry::parseText(const QString& id, const QString&
else if (key == "GenericName") data.genericName = value;
else if (key == "StartupWMClass") data.startupClass = value;
else if (key == "NoDisplay") data.noDisplay = value == "true";
else if (key == "Hidden") data.hidden = value == "true";
else if (key == "Comment") data.comment = value;
else if (key == "Icon") data.icon = value;
else if (key == "Exec") {
@ -495,6 +495,21 @@ void DesktopEntryManager::onScanCompleted(const QList<ParsedDesktopEntryData>& s
auto newLowercaseEntries = QHash<QString, DesktopEntry*>();
for (const auto& data: scanResults) {
auto lowerId = data.id.toLower();
if (data.hidden) {
if (auto* victim = newEntries.take(data.id)) victim->deleteLater();
newLowercaseEntries.remove(lowerId);
if (auto it = oldEntries.find(data.id); it != oldEntries.end()) {
it.value()->deleteLater();
oldEntries.erase(it);
}
qCDebug(logDesktopEntry) << "Masking hidden desktop entry" << data.id;
continue;
}
DesktopEntry* dentry = nullptr;
if (auto it = oldEntries.find(data.id); it != oldEntries.end()) {
@ -516,7 +531,6 @@ void DesktopEntryManager::onScanCompleted(const QList<ParsedDesktopEntryData>& s
qCDebug(logDesktopEntry) << "Found desktop entry" << data.id;
auto lowerId = data.id.toLower();
auto conflictingId = newEntries.contains(data.id);
if (conflictingId) {

View file

@ -33,6 +33,7 @@ struct ParsedDesktopEntryData {
QString genericName;
QString startupClass;
bool noDisplay = false;
bool hidden = false;
QString comment;
QString icon;
QString execString;