2021-09-25 21:02:00 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright 2021 Johannes Marbach
|
2024-01-12 09:51:43 +01:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2021-09-25 21:02:00 +02:00
|
|
|
*/
|
|
|
|
|
|
2024-01-12 10:00:05 +01:00
|
|
|
|
2021-09-25 21:02:00 +02:00
|
|
|
#ifndef UL_CONFIG_H
|
|
|
|
|
#define UL_CONFIG_H
|
|
|
|
|
|
2022-05-21 11:02:23 +00:00
|
|
|
|
2025-09-23 01:48:35 -07:00
|
|
|
#include "../shared/backends.h"
|
2024-03-30 08:06:29 +01:00
|
|
|
#include "../shared/themes.h"
|
2021-11-14 13:30:23 +01:00
|
|
|
|
2021-09-25 21:02:00 +02:00
|
|
|
#include "sq2lv_layouts.h"
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2022-06-14 00:02:02 +02:00
|
|
|
#include <stdint.h>
|
2025-10-21 17:51:58 +00:00
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2021-09-25 21:02:00 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* General options
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* If true, use animations */
|
|
|
|
|
bool animations;
|
2023-03-13 21:27:39 +01:00
|
|
|
/* Backend to use */
|
2025-09-23 01:48:35 -07:00
|
|
|
bbx_backends_backend_id_t backend;
|
2022-06-14 00:02:02 +02:00
|
|
|
/* Timeout (in seconds) - once elapsed, the device will shutdown. 0 (default) to disable */
|
|
|
|
|
uint16_t timeout;
|
2021-09-25 21:02:00 +02:00
|
|
|
} ul_config_opts_general;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Options related to the keyboard
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
2021-11-14 12:50:06 +01:00
|
|
|
/* If true, hide the keyboard on launch when a hardware keyboard is connected */
|
|
|
|
|
bool autohide;
|
2021-09-25 21:02:00 +02:00
|
|
|
/* Keyboard layout */
|
|
|
|
|
sq2lv_layout_id_t layout_id;
|
|
|
|
|
/* If true, display key popovers on press */
|
|
|
|
|
bool popovers;
|
|
|
|
|
} ul_config_opts_keyboard;
|
|
|
|
|
|
2021-11-14 13:30:23 +01:00
|
|
|
/**
|
|
|
|
|
* Options related to the password textarea
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* If true, disguise the entered text with dots */
|
|
|
|
|
bool obscured;
|
2022-05-30 21:18:25 +02:00
|
|
|
/* The character to use for disguising the entered text */
|
|
|
|
|
const char *bullet;
|
2021-11-14 13:30:23 +01:00
|
|
|
} ul_config_opts_textarea;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Options related to the theme
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* Default theme */
|
2024-03-30 20:52:01 +01:00
|
|
|
bbx_themes_theme_id_t default_id;
|
2021-11-14 13:30:23 +01:00
|
|
|
/* Alternate theme */
|
2024-03-30 20:52:01 +01:00
|
|
|
bbx_themes_theme_id_t alternate_id;
|
2021-11-14 13:30:23 +01:00
|
|
|
} ul_config_opts_theme;
|
|
|
|
|
|
2022-10-16 14:15:38 +02:00
|
|
|
/**
|
|
|
|
|
* Options related to input devices
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* If true and a keyboard device is connected, use it for input */
|
|
|
|
|
bool keyboard;
|
|
|
|
|
/* If true and a pointer device is connected, use it for input */
|
|
|
|
|
bool pointer;
|
|
|
|
|
/* If true and a touchscreen device is connected, use it for input */
|
|
|
|
|
bool touchscreen;
|
|
|
|
|
} ul_config_opts_input;
|
|
|
|
|
|
2023-03-13 21:27:39 +01:00
|
|
|
/**
|
|
|
|
|
* (Normally unneeded) quirky options
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
2023-07-28 20:47:23 +02:00
|
|
|
/* If true and using the framebuffer backend, force a refresh on every draw operation */
|
|
|
|
|
bool fbdev_force_refresh;
|
2023-03-13 21:27:39 +01:00
|
|
|
/* If true, do *not* switch terminal into graphics mode (will show terminal command prompt) */
|
|
|
|
|
bool terminal_prevent_graphics_mode;
|
|
|
|
|
/* If true, do *not* turn off terminal keyboard input (will show entered characters) */
|
|
|
|
|
bool terminal_allow_keyboard_input;
|
|
|
|
|
} ul_config_opts_quirks;
|
|
|
|
|
|
2021-09-25 21:02:00 +02:00
|
|
|
/**
|
|
|
|
|
* Options parsed from config file(s)
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* General options */
|
|
|
|
|
ul_config_opts_general general;
|
|
|
|
|
/* Options related to the keyboard */
|
|
|
|
|
ul_config_opts_keyboard keyboard;
|
2021-11-14 13:30:23 +01:00
|
|
|
/* Options related to the password textarea */
|
|
|
|
|
ul_config_opts_textarea textarea;
|
|
|
|
|
/* Options related to the theme */
|
|
|
|
|
ul_config_opts_theme theme;
|
2022-10-16 14:15:38 +02:00
|
|
|
/* Options related to input devices */
|
|
|
|
|
ul_config_opts_input input;
|
2025-10-21 17:51:58 +00:00
|
|
|
/* Options to create a keymap for hardware keyboards */
|
|
|
|
|
struct xkb_rule_names hw_keyboard;
|
2023-03-13 21:27:39 +01:00
|
|
|
/* Options related to (normally unneeded) quirks */
|
|
|
|
|
ul_config_opts_quirks quirks;
|
2021-09-25 21:02:00 +02:00
|
|
|
} ul_config_opts;
|
|
|
|
|
|
|
|
|
|
/**
|
2023-03-12 20:24:28 +00:00
|
|
|
* Initialise a config options struct with default values.
|
|
|
|
|
*
|
|
|
|
|
* @param opts pointer to the options struct
|
|
|
|
|
*/
|
|
|
|
|
void ul_config_init_opts(ul_config_opts *opts);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Find configuration files in a directory and parse them in alphabetic order.
|
|
|
|
|
*
|
|
|
|
|
* @param path directory path
|
|
|
|
|
* @param opts pointer for writing the parsed options into
|
|
|
|
|
*/
|
|
|
|
|
void ul_config_parse_directory(const char *path, ul_config_opts *opts);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parse one or more configuration files.
|
2021-09-25 21:02:00 +02:00
|
|
|
*
|
|
|
|
|
* @param files paths to configuration files
|
|
|
|
|
* @param num_files number of configuration files
|
|
|
|
|
* @param opts pointer for writing the parsed options into
|
|
|
|
|
*/
|
2023-03-12 20:24:28 +00:00
|
|
|
void ul_config_parse_files(const char **files, int num_files, ul_config_opts *opts);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parse a configuration file.
|
|
|
|
|
*
|
|
|
|
|
* @param path path to configuration file
|
|
|
|
|
* @param opts pointer for writing the parsed options into
|
|
|
|
|
*/
|
|
|
|
|
void ul_config_parse_file(const char *path, ul_config_opts *opts);
|
2021-09-25 21:02:00 +02:00
|
|
|
|
|
|
|
|
#endif /* UL_CONFIG_H */
|