From 81c331f66cc4d640ee759486ba21ace49cdd9d53 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Sat, 30 Mar 2024 08:28:41 +0100 Subject: [PATCH] Move theme config to other section --- buffyboard/buffyboard.conf | 4 ++-- buffyboard/config.c | 8 ++++---- buffyboard/config.h | 12 ++++++------ buffyboard/main.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/buffyboard/buffyboard.conf b/buffyboard/buffyboard.conf index 60d9157..b8db02f 100644 --- a/buffyboard/buffyboard.conf +++ b/buffyboard/buffyboard.conf @@ -1,5 +1,5 @@ -[general] -theme=breezy-light +[theme] +default=breezy-light #[quirks] #fbdev_force_refresh=true diff --git a/buffyboard/config.c b/buffyboard/config.c index 9f18f91..3b8488d 100644 --- a/buffyboard/config.c +++ b/buffyboard/config.c @@ -143,11 +143,11 @@ static void find_files(const char *path, char ***found, int *num_found) { static int parsing_handler(void* user_data, const char* section, const char* key, const char* value) { bb_config_opts *opts = (bb_config_opts *)user_data; - if (strcmp(section, "general") == 0) { - if (strcmp(key, "theme") == 0) { + if (strcmp(section, "theme") == 0) { + if (strcmp(key, "default") == 0) { bb_themes_theme_id_t id = bb_themes_find_theme_with_name(value); if (id != BB_THEMES_THEME_NONE) { - opts->general.theme_id = id; + opts->theme.default_id = id; return 1; } } @@ -183,7 +183,7 @@ static bool parse_bool(const char *value, bool *result) { */ void bb_config_init_opts(bb_config_opts *opts) { - opts->general.theme_id = BB_THEMES_THEME_BREEZY_DARK; + opts->theme.default_id = BB_THEMES_THEME_BREEZY_DARK; opts->quirks.fbdev_force_refresh = false; } diff --git a/buffyboard/config.h b/buffyboard/config.h index eab2e02..7e36246 100644 --- a/buffyboard/config.h +++ b/buffyboard/config.h @@ -12,12 +12,12 @@ #include "sq2lv_layouts.h" /** - * General options + * Options related to the theme */ typedef struct { - /* Theme */ - bb_themes_theme_id_t theme_id; -} bb_config_opts_general; + /* Default theme */ + bb_themes_theme_id_t default_id; +} ul_config_opts_theme; /** * (Normally unneeded) quirky options @@ -31,8 +31,8 @@ typedef struct { * Options parsed from config file(s) */ typedef struct { - /* General options */ - bb_config_opts_general general; + /* Options related to the theme */ + ul_config_opts_theme theme; /* Options related to (normally unneeded) quirks */ bb_config_opts_quirks quirks; } bb_config_opts; diff --git a/buffyboard/main.c b/buffyboard/main.c index 6acd470..83c59df 100644 --- a/buffyboard/main.c +++ b/buffyboard/main.c @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) { bb_indev_start_monitor_and_autoconnect(false, true, true); /* Initialise theme */ - bb_theme_apply(bb_themes_themes[conf_opts.general.theme_id]); + bb_theme_apply(bb_themes_themes[conf_opts.theme.default_id]); /* Add keyboard */ keyboard = lv_keyboard_create(lv_scr_act());