diff --git a/CHANGELOG.md b/CHANGELOG.md index bdc84da..b480746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ If a change only affects particular applications, they are listed in parentheses ## Unreleased +- feat(buffyboard): Add sticky_shift config option to control shift key behavior - fix(unl0kr): Two clicks were required to toggle the password when "obscured" is set to "false" in unl0kr.conf (!68, thanks @vstoiakin) - feat: Use events instead of threads for input processing (!63, thanks @vstoiakin) - fix(buffyboard): Fix initialization of uinput (!73, thanks @vstoiakin) diff --git a/buffyboard/buffyboard.conf b/buffyboard/buffyboard.conf index 10d07cd..68ba3ef 100644 --- a/buffyboard/buffyboard.conf +++ b/buffyboard/buffyboard.conf @@ -1,5 +1,6 @@ [keyboard] haptic_feedback=true +#sticky_shift=true [theme] default=breezy-light diff --git a/buffyboard/config.c b/buffyboard/config.c index 90223f8..ad7d899 100644 --- a/buffyboard/config.c +++ b/buffyboard/config.c @@ -45,6 +45,10 @@ static int parsing_handler(void* user_data, const char* section, const char* key if (bbx_config_parse_bool(value, &(opts->keyboard.haptic_feedback))) { return 1; } + } else if (strcmp(key, "sticky_shift") == 0) { + if (bbx_config_parse_bool(value, &(opts->keyboard.sticky_shift))) { + return 1; + } } } else if (strcmp(section, "theme") == 0) { if (strcmp(key, "default") == 0) { @@ -87,6 +91,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key void bb_config_init_opts(bb_config_opts *opts) { opts->keyboard.haptic_feedback = true; + opts->keyboard.sticky_shift = true; opts->theme.default_id = BBX_THEMES_THEME_BREEZY_DARK; opts->input.pointer = true; opts->input.touchscreen = true; diff --git a/buffyboard/config.h b/buffyboard/config.h index 57bd3bd..d5cd7bf 100644 --- a/buffyboard/config.h +++ b/buffyboard/config.h @@ -17,6 +17,9 @@ typedef struct { /* If true, vibrate on key presses */ bool haptic_feedback; + /* If true, remain in uppercase mode until shift is pressed again. + * If false, switch back to lowercase after a non-modifier key is pressed. */ + bool sticky_shift; } bb_config_opts_keyboard; /** diff --git a/buffyboard/main.c b/buffyboard/main.c index 093c32f..45198bd 100644 --- a/buffyboard/main.c +++ b/buffyboard/main.c @@ -116,6 +116,11 @@ static void keyboard_value_changed_cb(lv_event_t *event) { /* Pop any previously checked modifiers when a non-modifier key was pressed */ if (!is_modifier) { pop_checked_modifier_keys(); + + /* If sticky_shift is disabled and we're in uppercase mode, switch back to lowercase */ + if (!conf_opts.keyboard.sticky_shift && lv_keyboard_get_mode(keyboard) == LV_KEYBOARD_MODE_TEXT_UPPER) { + lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER); + } } } diff --git a/man/buffyboard.conf.5.scd b/man/buffyboard.conf.5.scd index 72c09c6..d174cc2 100644 --- a/man/buffyboard.conf.5.scd +++ b/man/buffyboard.conf.5.scd @@ -30,6 +30,13 @@ for and, if found, merged in the following order: Enable or disable vibrations when pressing keys. Default: true. +*sticky_shift* = + Changes shift key behavior. When true, the keyboard remains in uppercase mode + until the shift key is pressed again (sticky). When false, the keyboard switches + back to lowercase mode and the shift key deactivates after a non-modifier key is + pressed. + Default: true. + ## Theme *default* = Selects the default theme on boot. Can be changed at runtime to the