Skip to content

Conversation

bbedward
Copy link
Contributor

@bbedward bbedward commented Sep 18, 2025

Hidden desktop entries currently get parsed out, however all lower-ranked entires remain. So for example if I:

  • create ~/.local/share/applications/org.mozilla.Thunderbird.desktop with Hidden=true, it gets ignored by the parser. However the entry in /usr/share/applications/org.mozilla.Thunderbird.desktop does not get ignored.
  • Expectation would be that all instances of thunderbird get hidden.

This fixes it by:

  • Carrying hidden through the parsing stage
  • Removing all hidden entries in the scanner when it comes across one

Also it fixes the locale matching, by disqualifying mismatching modifies.

An example if evolution, which matched Name[en@shaw]=·𐑧𐑝𐑩𐑤𐑵𐑖𐑩𐑯 when the locale was en_US even though the territory modifier was missing from the locale.

Per the spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/localized-keys.html

f LC_MESSAGES does not have a MODIFIER field, then no key with a modifier will be matched. Similarly, if LC_MESSAGES does not have a COUNTRY field, then no key with a country specified will be matched

@bbedward bbedward changed the title src/desktopentry: fix handling of hidden entries core/desktopentry: fix handling of hidden entries Sep 18, 2025
@bbedward bbedward changed the title core/desktopentry: fix handling of hidden entries core/desktopentry: fix hidden entires and locale matching Sep 25, 2025
@outfoxxed outfoxxed force-pushed the master branch 2 times, most recently from e170d91 to 1d94144 Compare September 29, 2025 06:56
Comment on lines +510 to +513
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;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why deleteLater?
  2. Is hidden supposed to match only things lower than it in the path, or things higher than it as well? Because this looks like its only matching things lower than it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I just thought it's safer, if the object has any signals connected to ir and what not.
  2. Lower than it is the intention, that is my understanding of the specification

I mean my understanding of it is that only the highest priority desktop entry should be considered - so it shouldnt treat higher-prio entries as deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants