From bb80769bfdf2efcbf000bf838feaee0c1b31183d Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 26 Jul 2022 22:57:09 +0100 Subject: Add keyword matching for drun searches. There's starting to be a fair amount of duplicated code between the drun and normal run modes. At some point in the future, it's likely to be worth combining them, such that there's only a single `struct search_item` or similar, and just handle the different modes at the start and end of execution. --- src/desktop_vec.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/desktop_vec.h') diff --git a/src/desktop_vec.h b/src/desktop_vec.h index 9c15ad9..85c885e 100644 --- a/src/desktop_vec.h +++ b/src/desktop_vec.h @@ -3,11 +3,15 @@ #include #include +#include struct desktop_entry { char *id; char *name; char *path; + char *keywords; + uint32_t search_score; + uint32_t history_score; }; struct desktop_vec { @@ -23,11 +27,15 @@ void desktop_vec_add( struct desktop_vec *restrict vec, const char *restrict id, const char *restrict name, - const char *restrict path); + const char *restrict path, + const char *restrict keywords); void desktop_vec_add_file(struct desktop_vec *desktop, const char *id, const char *path); void desktop_vec_sort(struct desktop_vec *restrict vec); struct desktop_entry *desktop_vec_find(struct desktop_vec *restrict vec, const char *name); +struct string_vec desktop_vec_filter( + const struct desktop_vec *restrict vec, + const char *restrict substr); struct desktop_vec desktop_vec_load(FILE *file); void desktop_vec_save(struct desktop_vec *restrict vec, FILE *restrict file); -- cgit v1.2.3