summaryrefslogtreecommitdiff
path: root/lib/apps/apps.vala
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-11-01 14:44:49 +0100
committerGitHub <[email protected]>2024-11-01 14:44:49 +0100
commit0608b6b8aebb3d85993411b6c07f2850c404bd29 (patch)
tree39ab82c9b1b152467d885282ed72eae906f72a99 /lib/apps/apps.vala
parent2585ca7071638d90c02a2a21022815ac910fec07 (diff)
parente5d183860e6b21fee97e427ecac4867559b1c6e4 (diff)
Merge pull request #61 from matteo4375/apps/categories
apps: add option to include categories in queries
Diffstat (limited to 'lib/apps/apps.vala')
-rw-r--r--lib/apps/apps.vala13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/apps/apps.vala b/lib/apps/apps.vala
index dde7d44..30c305a 100644
--- a/lib/apps/apps.vala
+++ b/lib/apps/apps.vala
@@ -50,6 +50,12 @@ public class AstalApps.Apps : Object {
public double keywords_multiplier { get; set; default = 0.5; }
/**
+ * Extra multiplier to apply when matching the categories of an application.
+ * Defaults to `0.5`
+ */
+ public double categories_multiplier { get; set; default = 0.5; }
+
+ /**
* Consider the name of an application during queries.
* Defaults to `true`
*/
@@ -79,6 +85,12 @@ public class AstalApps.Apps : Object {
*/
public bool include_keywords { get; set; default = false; }
+ /**
+ * Consider the categories of an application during queries.
+ * Defaults to `false`
+ */
+ public bool include_categories { get; set; default = false; }
+
construct {
cache_directory = Environment.get_user_cache_dir() + "/astal";
cache_file = cache_directory + "/apps-frequents.json";
@@ -120,6 +132,7 @@ public class AstalApps.Apps : Object {
if (include_executable) r += s.executable * executable_multiplier;
if (include_description) r += s.description * description_multiplier;
if (include_keywords) r += s.keywords * keywords_multiplier;
+ if (include_categories) r += s.categories * categories_multiplier;
return r;
}