keyboard: add haptic feedback

This commit is contained in:
Vladimir Stoiakin 2025-11-26 12:34:09 +03:00
parent 271cdf8534
commit 6b3477dc78
19 changed files with 211 additions and 15 deletions

View file

@ -71,6 +71,10 @@ static int parsing_handler(void* user_data, const char* section, const char* key
if (bbx_config_parse_bool(value, &(opts->keyboard.popovers))) {
return 1;
}
} else if (strcmp(key, "haptic_feedback") == 0) {
if (bbx_config_parse_bool(value, &(opts->keyboard.haptic_feedback))) {
return 1;
}
}
} else if (strcmp(section, "textarea") == 0) {
if (strcmp(key, "obscured") == 0) {
@ -161,6 +165,7 @@ void ul_config_init_opts(ul_config_opts *opts) {
opts->keyboard.autohide = true;
opts->keyboard.layout_id = SQ2LV_LAYOUT_US;
opts->keyboard.popovers = true;
opts->keyboard.haptic_feedback = true;
opts->textarea.obscured = true;
opts->textarea.bullet = LV_SYMBOL_BULLET;
opts->theme.default_id = BBX_THEMES_THEME_BREEZY_DARK;

View file

@ -39,6 +39,8 @@ typedef struct {
sq2lv_layout_id_t layout_id;
/* If true, display key popovers on press */
bool popovers;
/* If true, vibrate on key presses */
bool haptic_feedback;
} ul_config_opts_keyboard;
/**

View file

@ -10,6 +10,7 @@
#include "../shared/backends.h"
#include "../shared/display.h"
#include "../shared/force_feedback.h"
#include "../shared/header.h"
#include "../shared/indev.h"
#include "../shared/keyboard.h"
@ -334,6 +335,8 @@ static void keyboard_value_changed_cb(lv_event_t *event) {
return;
}
bbx_force_feedback_play();
if (sq2lv_is_layer_switcher(kb, btn_id)) {
sq2lv_switch_layer(kb, btn_id);
return;
@ -447,7 +450,8 @@ int main(int argc, char *argv[]) {
.keymap = &conf_opts.hw_keyboard,
.keyboard = conf_opts.input.keyboard,
.pointer = conf_opts.input.pointer,
.touchscreen = conf_opts.input.touchscreen
.touchscreen = conf_opts.input.touchscreen,
.force_feedback = conf_opts.keyboard.haptic_feedback
};
if (bbx_indev_init(fd_epoll, &input_config) == 0)
exit_failure();

View file

@ -7,6 +7,7 @@ animations=true
autohide=false
layout=us
popovers=true
haptic_feedback=true
[textarea]
obscured=true