diff options
Diffstat (limited to 'lib/apps/apps.vala')
-rw-r--r-- | lib/apps/apps.vala | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/lib/apps/apps.vala b/lib/apps/apps.vala index dde7d44..999643c 100644 --- a/lib/apps/apps.vala +++ b/lib/apps/apps.vala @@ -1,3 +1,8 @@ +/** + * This object can be used to query applications. + * Multipliers can be set to customize [[email protected]] results + * from queries which then are summed and sorted accordingly. + */ public class AstalApps.Apps : Object { private string cache_directory; private string cache_file; @@ -27,21 +32,21 @@ public class AstalApps.Apps : Object { /** * Extra multiplier to apply when matching the entry of an application. - * Defaults to `1` + * Defaults to `0` */ - public double entry_multiplier { get; set; default = 1; } + public double entry_multiplier { get; set; default = 0; } /** * Extra multiplier to apply when matching the executable of an application. - * Defaults to `1` + * Defaults to `0.5` */ - public double executable_multiplier { get; set; default = 1; } + public double executable_multiplier { get; set; default = 0.5; } /** * Extra multiplier to apply when matching the description of an application. - * Defaults to `0.5` + * Defaults to `0` */ - public double description_multiplier { get; set; default = 0.5; } + public double description_multiplier { get; set; default = 0; } /** * Extra multiplier to apply when matching the keywords of an application. @@ -50,34 +55,10 @@ public class AstalApps.Apps : Object { public double keywords_multiplier { get; set; default = 0.5; } /** - * Consider the name of an application during queries. - * Defaults to `true` - */ - public bool include_name { get; set; default = true; } - - /** - * Consider the entry of an application during queries. - * Defaults to `false` - */ - public bool include_entry { get; set; default = false; } - - /** - * Consider the executable of an application during queries. - * Defaults to `false` - */ - public bool include_executable { get; set; default = false; } - - /** - * Consider the description of an application during queries. - * Defaults to `false` - */ - public bool include_description { get; set; default = false; } - - /** - * Consider the keywords of an application during queries. - * Defaults to `false` + * Extra multiplier to apply when matching the categories of an application. + * Defaults to `0` */ - public bool include_keywords { get; set; default = false; } + public double categories_multiplier { get; set; default = 0; } construct { cache_directory = Environment.get_user_cache_dir() + "/astal"; @@ -115,11 +96,12 @@ public class AstalApps.Apps : Object { if (alg == FUZZY) s = a.fuzzy_match(search); if (alg == EXACT) s = a.exact_match(search); - if (include_name) r += s.name * name_multiplier; - if (include_entry) r += s.entry * entry_multiplier; - if (include_executable) r += s.executable * executable_multiplier; - if (include_description) r += s.description * description_multiplier; - if (include_keywords) r += s.keywords * keywords_multiplier; + r += s.name * name_multiplier; + r += s.entry * entry_multiplier; + r += s.executable * executable_multiplier; + r += s.description * description_multiplier; + r += s.keywords * keywords_multiplier; + r += s.categories * categories_multiplier; return r; } |