mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
core/desktopentry: prioritize fallback keys over mismatched keys
The fallback key will now be selected when there isn't a more specific key to select, instead of the first key.
This commit is contained in:
1 file changed
+5
-2
@@ -142,7 +142,7 @@ void DesktopEntry::parseEntry(const QString& text) {
|
||||
|
||||
auto splitIdx = line.indexOf(u'=');
|
||||
if (splitIdx == -1) {
|
||||
qCDebug(logDesktopEntry) << "Encountered invalid line in desktop entry (no =)" << line;
|
||||
qCWarning(logDesktopEntry) << "Encountered invalid line in desktop entry (no =)" << line;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,10 @@ void DesktopEntry::parseEntry(const QString& text) {
|
||||
if (entries.contains(key)) {
|
||||
const auto& old = entries.value(key);
|
||||
|
||||
if (system.matchScore(locale) > system.matchScore(old.first)) {
|
||||
auto oldScore = system.matchScore(old.first);
|
||||
auto newScore = system.matchScore(locale);
|
||||
|
||||
if (newScore > oldScore || (oldScore == 0 && !locale.isValid())) {
|
||||
entries.insert(key, qMakePair(locale, value));
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user