From 61727b01ba06f876664addca83e774cb2bad9ce9 Mon Sep 17 00:00:00 2001 From: matteo4375 <160355435+matteo4375@users.noreply.github.com> Date: Thu, 24 Oct 2024 17:39:38 -0400 Subject: apps: add option to include keywords in queries (#56) --- lib/apps/apps.vala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/apps/apps.vala') diff --git a/lib/apps/apps.vala b/lib/apps/apps.vala index ac48121..dde7d44 100644 --- a/lib/apps/apps.vala +++ b/lib/apps/apps.vala @@ -43,6 +43,12 @@ public class AstalApps.Apps : Object { */ public double description_multiplier { get; set; default = 0.5; } + /** + * Extra multiplier to apply when matching the keywords of an application. + * Defaults to `0.5` + */ + public double keywords_multiplier { get; set; default = 0.5; } + /** * Consider the name of an application during queries. * Defaults to `true` @@ -67,6 +73,12 @@ public class AstalApps.Apps : Object { */ public bool include_description { get; set; default = false; } + /** + * Consider the keywords of an application during queries. + * Defaults to `false` + */ + public bool include_keywords { get; set; default = false; } + construct { cache_directory = Environment.get_user_cache_dir() + "/astal"; cache_file = cache_directory + "/apps-frequents.json"; @@ -107,6 +119,7 @@ public class AstalApps.Apps : Object { 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; return r; } -- cgit v1.2.3