feat: add xkb rule config option

This commit is contained in:
DreamMaoMao 2025-06-09 23:50:20 +08:00
parent 860e1805d1
commit 9e58c54830
2 changed files with 13 additions and 1 deletions

View file

@ -242,6 +242,7 @@ typedef struct {
int single_scratchpad;
int xwayland_persistence;
struct xkb_rule_names xkb_rules;
} Config;
typedef void (*FuncType)(const Arg *);
@ -877,6 +878,16 @@ void parse_config_line(Config *config, const char *line) {
config->drag_tile_to_tile = atoi(value);
} else if (strcmp(key, "swipe_min_threshold") == 0) {
config->swipe_min_threshold = atoi(value);
} else if (!xkb_rules.rules && strcmp(key, "xkb_rules_rules") == 0) {
xkb_rules.rules = strdup(value);
} else if (!xkb_rules.model && strcmp(key, "xkb_rules_model") == 0) {
xkb_rules.model = strdup(value);
} else if (!xkb_rules.layout && strcmp(key, "xkb_rules_layout") == 0) {
xkb_rules.layout = strdup(value);
} else if (!xkb_rules.variant && strcmp(key, "xkb_rules_variant") == 0) {
xkb_rules.variant = strdup(value);
} else if (!xkb_rules.options && strcmp(key, "xkb_rules_options") == 0) {
xkb_rules.options = strdup(value);
} else if (strcmp(key, "scroller_proportion_preset") == 0) {
// 1. 统计 value 中有多少个逗号,确定需要解析的浮点数个数
int count = 0; // 初始化为 0