diff --git a/CHANGELOG.md b/CHANGELOG.md index 61acc37..41fd0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- feat: Add config option to customise bullet character (#17) - fix: Use actual screen DPI value to compute sizes and spaces ## 0.2.0 (2022-05-27) diff --git a/config.c b/config.c index da4c985..11c9bbc 100644 --- a/config.c +++ b/config.c @@ -78,6 +78,7 @@ static void init_opts(ul_config_opts *opts) { opts->keyboard.layout_id = SQ2LV_LAYOUT_US; opts->keyboard.popovers = false; opts->textarea.obscured = true; + opts->textarea.bullet = LV_SYMBOL_BULLET; opts->theme.default_id = UL_THEMES_THEME_BREEZY_DARK; opts->theme.alternate_id = UL_THEMES_THEME_BREEZY_LIGHT; } @@ -125,6 +126,13 @@ static int parsing_handler(void* user_data, const char* section, const char* key return 1; } } + if (strcmp(key, "bullet") == 0) { + char *bullet = strdup(value); + if (bullet) { + opts->textarea.bullet = bullet; + return 1; + } + } } else if (strcmp(section, "theme") == 0) { if (strcmp(key, "default") == 0) { ul_themes_theme_id_t id = ul_themes_find_theme_with_name(value); diff --git a/config.h b/config.h index 948f29c..689cbf3 100644 --- a/config.h +++ b/config.h @@ -57,6 +57,8 @@ typedef struct { typedef struct { /* If true, disguise the entered text with dots */ bool obscured; + /* The character to use for disguising the entered text */ + const char *bullet; } ul_config_opts_textarea; /** diff --git a/main.c b/main.c index 160e141..f6f1679 100644 --- a/main.c +++ b/main.c @@ -512,6 +512,7 @@ int main(int argc, char *argv[]) { lv_obj_t *textarea = lv_textarea_create(textarea_container); lv_textarea_set_one_line(textarea, true); lv_textarea_set_password_mode(textarea, true); + lv_textarea_set_password_bullet(textarea, conf_opts.textarea.bullet); lv_textarea_set_placeholder_text(textarea, "Enter password..."); lv_obj_add_event_cb(textarea, textarea_ready_cb, LV_EVENT_READY, NULL); lv_obj_set_flex_grow(textarea, 1); diff --git a/unl0kr.conf b/unl0kr.conf index 9e75f31..6511a96 100644 --- a/unl0kr.conf +++ b/unl0kr.conf @@ -9,6 +9,7 @@ popovers=true [textarea] obscured=true +#bullet= [theme] default=breezy-dark