diff options
| author | frosty <gabriel@bwaaa.monster> | 2026-08-12 20:21:12 -0400 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-08-12 20:21:12 -0400 |
| commit | a20a9e8878ab6708bd3e3ecb4b1cee8728436dd0 (patch) | |
| tree | c007b81d99b2dc3be92ae625e34881b0f7cf6943 /src/Utility | |
| parent | 10d44e7ff547a806e4bf109e7aadd48488ddc9f0 (diff) | |
| download | omnisearch-a20a9e8878ab6708bd3e3ecb4b1cee8728436dd0.tar.gz | |
feat: add default search engine option
Diffstat (limited to 'src/Utility')
| -rw-r--r-- | src/Utility/Utility.c | 9 | ||||
| -rw-r--r-- | src/Utility/Utility.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Utility/Utility.c b/src/Utility/Utility.c index 5183efe..35fc491 100644 --- a/src/Utility/Utility.c +++ b/src/Utility/Utility.c @@ -217,6 +217,15 @@ int user_engines_contains(const char *engine_id, char **ids, int count) { return 0; } +char *get_default_search_engine(void) { + char *cookie = get_cookie("default_engine"); + if (cookie && (strcmp(cookie, "all") == 0 || is_engine_id_enabled(cookie))) + return cookie; + + free(cookie); + return strdup("all"); +} + void free_string_matrix(char ***matrix, int *inner_counts, int row_count) { if (matrix) { for (int i = 0; i < row_count; i++) { diff --git a/src/Utility/Utility.h b/src/Utility/Utility.h index a78fe65..a194f21 100644 --- a/src/Utility/Utility.h +++ b/src/Utility/Utility.h @@ -30,6 +30,7 @@ char *get_locale(const char *default_locale); int is_engine_id_enabled(const char *engine_id); int get_user_engines(char ***out_ids, int *out_count); int user_engines_contains(const char *engine_id, char **ids, int count); +char *get_default_search_engine(void); void free_string_matrix(char ***matrix, int *inner_counts, int row_count); |
