mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-03-13 02:42:47 +01:00
main: Allow user to override layers in landscape mode
Add a new parameter `--landscape-layers` as well as an environment variable `WVKBD_LANDSCAPE_LAYERS` that allows the user to override the default set of layers in landscape mode. This complements the existing `-l` parameter and `WVKBD_LAYERS` environment variable, which do the equivalent for non-landscape mode. Furthermore, add documentation for the new switch. Move the `-l` parameter to the bottom so we don't have to realign all parameters and so all layer-related parameters are grouped together.
This commit is contained in:
parent
dfae590264
commit
9bbc8d4a99
19
main.c
19
main.c
@ -362,7 +362,6 @@ usage(char *argv0) {
|
|||||||
fprintf(stderr, " -D - Enable debug\n");
|
fprintf(stderr, " -D - Enable debug\n");
|
||||||
fprintf(stderr, " -o - Print pressed keys to standard output\n");
|
fprintf(stderr, " -o - Print pressed keys to standard output\n");
|
||||||
fprintf(stderr, " -O - Print intersected keys to standard output\n");
|
fprintf(stderr, " -O - Print intersected keys to standard output\n");
|
||||||
fprintf(stderr, " -l - Comma separated list of layers\n");
|
|
||||||
fprintf(stderr, " -H [int] - Height in pixels\n");
|
fprintf(stderr, " -H [int] - Height in pixels\n");
|
||||||
fprintf(stderr, " -L [int] - Landscape height in pixels\n");
|
fprintf(stderr, " -L [int] - Landscape height in pixels\n");
|
||||||
fprintf(stderr, " --fn [font] - Set font (e.g: DejaVu Sans 20)\n");
|
fprintf(stderr, " --fn [font] - Set font (e.g: DejaVu Sans 20)\n");
|
||||||
@ -377,6 +376,8 @@ usage(char *argv0) {
|
|||||||
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");
|
fprintf(stderr, " --list-layers - Print the list of available layers\n");
|
||||||
|
fprintf(stderr, " -l - Comma separated list of layers\n");
|
||||||
|
fprintf(stderr, " --landscape-layers - Comma separated list of landscape layers\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -461,7 +462,7 @@ set_kbd_colors(uint8_t * bgra, char * hex) {
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
/* parse command line arguments */
|
/* parse command line arguments */
|
||||||
char *layer_names_list = NULL;
|
char *layer_names_list = NULL, *landscape_layer_names_list = NULL;
|
||||||
const char *fc_font_pattern = NULL;
|
const char *fc_font_pattern = NULL;
|
||||||
height = normal_height = KBD_PIXEL_HEIGHT;
|
height = normal_height = KBD_PIXEL_HEIGHT;
|
||||||
landscape_height = KBD_PIXEL_LANDSCAPE_HEIGHT;
|
landscape_height = KBD_PIXEL_LANDSCAPE_HEIGHT;
|
||||||
@ -469,6 +470,8 @@ main(int argc, char **argv) {
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
if ((tmp = getenv("WVKBD_LAYERS")))
|
if ((tmp = getenv("WVKBD_LAYERS")))
|
||||||
layer_names_list = estrdup(tmp);
|
layer_names_list = estrdup(tmp);
|
||||||
|
if ((tmp = getenv("WVKBD_LANDSCAPE_LAYERS")))
|
||||||
|
landscape_layer_names_list = estrdup(tmp);
|
||||||
if ((tmp = getenv("WVKBD_HEIGHT")))
|
if ((tmp = getenv("WVKBD_HEIGHT")))
|
||||||
normal_height = atoi(tmp);
|
normal_height = atoi(tmp);
|
||||||
if ((tmp = getenv("WVKBD_LANDSCAPE_HEIGHT")))
|
if ((tmp = getenv("WVKBD_LANDSCAPE_HEIGHT")))
|
||||||
@ -497,6 +500,15 @@ main(int argc, char **argv) {
|
|||||||
if (layer_names_list)
|
if (layer_names_list)
|
||||||
free(layer_names_list);
|
free(layer_names_list);
|
||||||
layer_names_list = estrdup(argv[++i]);
|
layer_names_list = estrdup(argv[++i]);
|
||||||
|
} else if ((!strcmp(argv[i], "-landscape-layers")) ||
|
||||||
|
(!strcmp(argv[i], "--landscape-layers"))) {
|
||||||
|
if (i >= argc - 1) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (landscape_layer_names_list)
|
||||||
|
free(landscape_layer_names_list);
|
||||||
|
landscape_layer_names_list = estrdup(argv[++i]);
|
||||||
} else if ((!strcmp(argv[i], "-bg")) || (!strcmp(argv[i], "--bg"))) {
|
} else if ((!strcmp(argv[i], "-bg")) || (!strcmp(argv[i], "--bg"))) {
|
||||||
if (i >= argc - 1) {
|
if (i >= argc - 1) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
@ -624,7 +636,8 @@ main(int argc, char **argv) {
|
|||||||
die("failed to init virtual keyboard_manager\n");
|
die("failed to init virtual keyboard_manager\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
kbd_init(&keyboard, (struct layout *)&layouts, layer_names_list);
|
kbd_init(&keyboard, (struct layout *)&layouts,
|
||||||
|
layer_names_list, landscape_layer_names_list);
|
||||||
|
|
||||||
draw_ctx.font_description =
|
draw_ctx.font_description =
|
||||||
pango_font_description_from_string(fc_font_pattern);
|
pango_font_description_from_string(fc_font_pattern);
|
||||||
|
5
wvkbd.1
5
wvkbd.1
@ -34,6 +34,11 @@ print intersected keys to standard output
|
|||||||
comma separated list of layers
|
comma separated list of layers
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
|
\fB--landscape-layers\fR
|
||||||
|
.RS 4
|
||||||
|
comma separated list of layers used in landscape mode
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
\fB-H\fR \fIPX\fR
|
\fB-H\fR \fIPX\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
height in pixels
|
height in pixels
|
||||||
|
Loading…
x
Reference in New Issue
Block a user