Add autohide config option

This commit is contained in:
Johannes Marbach 2021-11-14 12:50:06 +01:00
parent 01fe6dd7bb
commit 5c3ad9bf9a
4 changed files with 12 additions and 5 deletions

View file

@ -100,8 +100,8 @@ static int parsing_handler(void* user_data, const char* section, const char* key
}
}
} else if (strcmp(section, "keyboard") == 0) {
if (strcmp(key, "popovers") == 0) {
if (parse_bool(value, &(opts->keyboard.popovers))) {
if (strcmp(key, "autohide") == 0) {
if (parse_bool(value, &(opts->keyboard.autohide))) {
return 1;
}
} else if (strcmp(key, "layout") == 0) {
@ -110,7 +110,11 @@ static int parsing_handler(void* user_data, const char* section, const char* key
opts->keyboard.layout_id = id;
return 1;
}
};
} else if (strcmp(key, "popovers") == 0) {
if (parse_bool(value, &(opts->keyboard.popovers))) {
return 1;
}
}
}
ul_log(UL_LOG_LEVEL_ERROR, "Ignoring invalid config value \"%s\" for key \"%s\" in section \"%s\"", value, key, section);

View file

@ -45,6 +45,8 @@ typedef struct {
* Options related to the keyboard
*/
typedef struct {
/* If true, hide the keyboard on launch when a hardware keyboard is connected */
bool autohide;
/* Keyboard layout */
sq2lv_layout_id_t layout_id;
/* If true, display key popovers on press */

2
main.c
View file

@ -329,7 +329,7 @@ int main(int argc, char *argv[]) {
ul_indev_set_up_mouse_cursor();
/* Hide the on-screen keyboard by default if a physical keyboard is connected */
if (ul_indev_is_keyboard_connected()) {
if (conf_opts.keyboard.autohide && ul_indev_is_keyboard_connected()) {
is_keyboard_hidden = true;
}

View file

@ -5,5 +5,6 @@ animations=true
obscured=true
[keyboard]
popovers=true
autohide=true
layout=de
popovers=true