Add a --list-layers option

To get a list of available layers for the -l option.

Signed-off-by: Emmanuel LE TRONG <emmanuel.le-trong@cnrs-orleans.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
Emmanuel LE TRONG 2022-08-16 16:16:08 +02:00 committed by Maarten van Gompel
parent 7af52d695d
commit acf38cf46e

15
main.c
View File

@ -376,6 +376,17 @@ usage(char *argv0) {
fprintf(stderr, " --swipe-sp [rrggbb|aa] - Set color of swiped special keys\n"); fprintf(stderr, " --swipe-sp [rrggbb|aa] - Set color of swiped special keys\n");
fprintf(stderr, " --text [rrggbb|aa] - Set color of text on keys\n"); fprintf(stderr, " --text [rrggbb|aa] - Set color of text on keys\n");
fprintf(stderr, " --text-sp [rrggbb|aa] - Set color of text on special keys\n"); fprintf(stderr, " --text-sp [rrggbb|aa] - Set color of text on special keys\n");
fprintf(stderr, " --list-layers - Print the list of available layers\n");
}
void
list_layers() {
int i;
for (i = 0; i < NumLayouts - 1; i++) {
if (layouts[i].name) {
puts(layouts[i].name);
}
}
} }
void void
@ -567,6 +578,10 @@ main(int argc, char **argv) {
} else if ((!strcmp(argv[i], "-hidden")) || } else if ((!strcmp(argv[i], "-hidden")) ||
(!strcmp(argv[i], "--hidden"))) { (!strcmp(argv[i], "--hidden"))) {
hidden = true; hidden = true;
} else if ((!strcmp(argv[i], "-list-layers")) ||
(!strcmp(argv[i], "--list-layers"))) {
list_layers();
exit(0);
} else { } else {
fprintf(stderr, "Invalid argument: %s\n", argv[i]); fprintf(stderr, "Invalid argument: %s\n", argv[i]);
usage(argv[0]); usage(argv[0]);