Added exclusive flag

This commit is contained in:
Demperor 2026-05-11 14:59:44 +02:00
parent f1970d772a
commit d3de3d3f10
2 changed files with 68 additions and 3 deletions

View file

@ -45,6 +45,7 @@ typedef struct {
bool islockapply;
bool isreleaseapply;
bool ispassapply;
bool isexclusiveapply; // Requires isreleaseapply.
} KeyBinding;
typedef struct {
@ -500,6 +501,9 @@ void parse_bind_flags(const char *str, KeyBinding *kb) {
case 'p':
kb->ispassapply = true;
break;
case 'e':
kb->isexclusiveapply = true;
break;
default:
fprintf(stderr,
"\033[1m\033[31m[ERROR]:\033[33m Unknown bind flag: %c\n",
@ -507,6 +511,13 @@ void parse_bind_flags(const char *str, KeyBinding *kb) {
break;
}
}
if (kb->isexclusiveapply && !kb->isreleaseapply) {
fprintf(stderr,
"\033[1m\033[31m[ERROR]:\033[33m Exclusive bind flag "
"requires release flag ('r')\n");
kb->isexclusiveapply = false;
}
}
int32_t parse_circle_direction(const char *str) {
@ -2342,7 +2353,7 @@ bool parse_option(Config *config, char *key, char *value) {
config->exec_once_count++;
} else if (regex_match("^bind[s|l|r|p]*$", key)) {
} else if (regex_match("^bind[s|l|e|r|p]*$", key)) {
config->key_bindings =
realloc(config->key_bindings,
(config->key_bindings_count + 1) * sizeof(KeyBinding));