Move theme config to other section

This commit is contained in:
Johannes Marbach 2024-03-30 08:28:41 +01:00
parent fd0bd170a1
commit 81c331f66c
4 changed files with 13 additions and 13 deletions

View file

@ -1,5 +1,5 @@
[general]
theme=breezy-light
[theme]
default=breezy-light
#[quirks]
#fbdev_force_refresh=true

View file

@ -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;
}

View file

@ -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;

View file

@ -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());