diff options
Diffstat (limited to 'lib/apps')
-rw-r--r-- | lib/apps/default.nix | 15 | ||||
-rw-r--r-- | lib/apps/fuzzy.vala | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/apps/default.nix b/lib/apps/default.nix new file mode 100644 index 0000000..64466a2 --- /dev/null +++ b/lib/apps/default.nix @@ -0,0 +1,15 @@ +{ + mkAstalPkg, + pkgs, + ... +}: +mkAstalPkg { + pname = "astal-apps"; + src = ./.; + packages = [pkgs.json-glib]; + + libname = "apps"; + gir-suffix = "Apps"; + authors = "Aylur"; + description = "Application query library"; +} diff --git a/lib/apps/fuzzy.vala b/lib/apps/fuzzy.vala index 7745320..590112e 100644 --- a/lib/apps/fuzzy.vala +++ b/lib/apps/fuzzy.vala @@ -2,15 +2,15 @@ namespace AstalApps { private int fuzzy_match_string(string pattern, string str) { const int unmatched_letter_penalty = -1; int score = 100; + int not_found_score = -10; if (pattern.length == 0) return score; - if (str.length < pattern.length) return int.MIN; + if (str.length < pattern.length) return not_found_score; bool found = fuzzy_match_recurse(pattern, str, score, true, out score); score += unmatched_letter_penalty * (str.length - pattern.length); - if(!found) score = -10; - + if(!found) score = not_found_score; return score; } |