Add config option to customise bullet character

Fixes #17
This commit is contained in:
Johannes Marbach 2022-05-30 21:18:25 +02:00
parent 7345665382
commit 4117778324
5 changed files with 13 additions and 0 deletions

View file

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

View file

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

View file

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

1
main.c
View file

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

View file

@ -9,6 +9,7 @@ popovers=true
[textarea]
obscured=true
#bullet=
[theme]
default=breezy-dark