diff options
| author | frosty <gabriel@bwaaa.monster> | 2026-03-30 10:37:46 +0300 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-03-30 10:37:46 +0300 |
| commit | c3ed9017385342944badec46de263560c6ab07c8 (patch) | |
| tree | d7f7e86e26ebffd9f277fc340b74a1681eb707d7 /src/Utility | |
| parent | 9e6e76306471b3cc139ae68c0363ec95616d1b23 (diff) | |
| download | omnisearch-c3ed9017385342944badec46de263560c6ab07c8.tar.gz | |
feat: begin adding settings menu, move theme to settings
Diffstat (limited to 'src/Utility')
| -rw-r--r-- | src/Utility/Utility.c | 14 | ||||
| -rw-r--r-- | src/Utility/Utility.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/Utility/Utility.c b/src/Utility/Utility.c index 3be4ef4..b4ad91d 100644 --- a/src/Utility/Utility.c +++ b/src/Utility/Utility.c @@ -1,4 +1,7 @@ #include "Utility.h" +#include <beaker.h> +#include <stdlib.h> +#include <string.h> int hex_to_int(char c) { if (c >= '0' && c <= '9') @@ -9,3 +12,14 @@ int hex_to_int(char c) { return c - 'A' + 10; return -1; } + +char *get_theme(const char *default_theme) { + char *cookie = get_cookie("theme"); + if (cookie && + (strcmp(cookie, "light") == 0 || + strcmp(cookie, "dark") == 0)) { + return cookie; + } + free(cookie); + return strdup(default_theme); +} diff --git a/src/Utility/Utility.h b/src/Utility/Utility.h index 3b0181c..e67282f 100644 --- a/src/Utility/Utility.h +++ b/src/Utility/Utility.h @@ -2,5 +2,6 @@ #define UTILITY_H int hex_to_int(char c); +char *get_theme(const char *default_theme); #endif |
