mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
core/desktopentry: don't match keys with wrong modifier or country
This commit is contained in:
parent
8d2a2d3dd2
commit
a94418f45d
2 changed files with 7 additions and 4 deletions
|
|
@ -12,3 +12,4 @@
|
||||||
- Fixed a rare crash when disconnecting a monitor.
|
- Fixed a rare crash when disconnecting a monitor.
|
||||||
- Fixed build issues preventing cross compilation from working.
|
- Fixed build issues preventing cross compilation from working.
|
||||||
- Fixed dekstop entries with lower priority than a hidden entry not being hidden.
|
- Fixed dekstop entries with lower priority than a hidden entry not being hidden.
|
||||||
|
- Fixed desktop entry keys with mismatched modifier or country not being discarded.
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,14 @@ struct Locale {
|
||||||
|
|
||||||
[[nodiscard]] int matchScore(const Locale& other) const {
|
[[nodiscard]] int matchScore(const Locale& other) const {
|
||||||
if (this->language != other.language) return 0;
|
if (this->language != other.language) return 0;
|
||||||
auto territoryMatches = !this->territory.isEmpty() && this->territory == other.territory;
|
|
||||||
auto modifierMatches = !this->modifier.isEmpty() && this->modifier == other.modifier;
|
if (!other.modifier.isEmpty() && this->modifier != other.modifier) return 0;
|
||||||
|
if (!other.territory.isEmpty() && this->territory != other.territory) return 0;
|
||||||
|
|
||||||
auto score = 1;
|
auto score = 1;
|
||||||
if (territoryMatches) score += 2;
|
|
||||||
if (modifierMatches) score += 1;
|
if (!other.territory.isEmpty()) score += 2;
|
||||||
|
if (!other.modifier.isEmpty()) score += 1;
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue