parse keys as case-insensitive

xkbcommon
Alessandro Mauri 4 years ago
parent 79bbbcf8a9
commit d3f5e888e3
  1. 6
      hkd.1
  2. 4
      hkd.c

@ -76,10 +76,8 @@ include normal keys, multimedia keys and special keys, for the full list
of available keys either refer to the header file or this project's hkd.c of available keys either refer to the header file or this project's hkd.c
source file. Keys as specified by the kernel are named "KEY_<name>", in this source file. Keys as specified by the kernel are named "KEY_<name>", in this
configuration file only the <name> is required. configuration file only the <name> is required.
Key names are always capitalized and do not differenciate between upper or Key names are case-insensitive and are parsed as a list of comma separated
lower case, as such hotkeys that require a capitalized letter need to include strings, such as: 'leftmeta,UP', 'VOLUMEUP' or 'leftctrl,LEFTALT,cancel'.
RIGHTSHIFT or LEFTSHIFT in the keys section.
Keys are intended as a list of comma separated strings.
.PP .PP
hkd can live reload the configuration file by signaling it with hkd can live reload the configuration file by signaling it with
.I SIGUSR1 .I SIGUSR1

@ -918,6 +918,10 @@ void parse_config_file (void)
unsigned short key_to_code (char *key) unsigned short key_to_code (char *key)
{ {
for (char *tmp = key; *tmp; tmp++) {
if (islower(*tmp))
*tmp += 'A' - 'a';
}
for (int i = 0; i < array_size_const(key_conversion_table); i++) { for (int i = 0; i < array_size_const(key_conversion_table); i++) {
if (!strcmp(key_conversion_table[i].name, key)) if (!strcmp(key_conversion_table[i].name, key))
return key_conversion_table[i].value; return key_conversion_table[i].value;

Loading…
Cancel
Save