buffyboard: add sticky_shift config option

Adds a keyboard config option to control shift key behavior.
When sticky_shift is enabled (default), the keyboard remains
in uppercase mode until the shift key is pressed again.
When disabled, the keyboard switches back into lowercase mode
when a non-modifier key is pressed.
This commit is contained in:
Nettika 2026-02-22 23:43:51 -08:00
parent 32b4e069bd
commit c3e12af143
No known key found for this signature in database
GPG key ID: C357EE70D5027BCC
6 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,6 @@
[keyboard]
haptic_feedback=true
#sticky_shift=true
[theme]
default=breezy-light

View file

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

View file

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

View file

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