mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2026-04-09 14:42:30 +02:00
Add arguments to define different text color for pressed and swiped keys
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
committed by
Maarten van Gompel
parent
4366d88eca
commit
e67a5afce9
@@ -14,6 +14,8 @@ struct clr_scheme schemes[] = {
|
||||
.high = {.bgra = {100, 100, 100, transparency}},
|
||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||
.text = {.color = UINT32_MAX},
|
||||
.text_press = {.color = UINT32_MAX},
|
||||
.text_swipe = {.color = UINT32_MAX},
|
||||
.font = DEFAULT_FONT,
|
||||
.rounding = DEFAULT_ROUNDING,
|
||||
},
|
||||
@@ -23,6 +25,8 @@ struct clr_scheme schemes[] = {
|
||||
.fg = {.bgra = {32, 32, 32, transparency}},
|
||||
.high = {.bgra = {100, 100, 100, transparency}},
|
||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||
.text_press = {.color = UINT32_MAX},
|
||||
.text_swipe = {.color = UINT32_MAX},
|
||||
.text = {.color = UINT32_MAX},
|
||||
.font = DEFAULT_FONT,
|
||||
.rounding = DEFAULT_ROUNDING,
|
||||
|
||||
13
keyboard.c
13
keyboard.c
@@ -616,19 +616,26 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
|
||||
case Unpress:
|
||||
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||
scheme->fg, scheme->rounding);
|
||||
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
break;
|
||||
case Press:
|
||||
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||
scheme->high, scheme->rounding);
|
||||
drw_draw_text(kb->surf, scheme->text_press, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
break;
|
||||
case Swipe:
|
||||
draw_over_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||
scheme->swipe, scheme->rounding);
|
||||
drw_draw_text(kb->surf, scheme->text_swipe, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
break;
|
||||
default:
|
||||
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
}
|
||||
|
||||
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
|
||||
if (type == Press || type == Unpress) {
|
||||
kbd_clear_last_popup(kb);
|
||||
@@ -642,7 +649,7 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
|
||||
kb->last_popup_y, k->w, k->h, scheme->rounding);
|
||||
draw_inset(kb->popup_surf, k->x, kb->last_popup_y, k->w, k->h,
|
||||
KBD_KEY_BORDER, scheme->high, scheme->rounding);
|
||||
drw_draw_text(kb->popup_surf, scheme->text, k->x, kb->last_popup_y,
|
||||
drw_draw_text(kb->popup_surf, scheme->text_press, k->x, kb->last_popup_y,
|
||||
k->w, k->h, KBD_KEY_BORDER, label,
|
||||
scheme->font_description);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ struct clr_scheme {
|
||||
Color high;
|
||||
Color swipe;
|
||||
Color text;
|
||||
Color text_press;
|
||||
Color text_swipe;
|
||||
char *font;
|
||||
int rounding;
|
||||
PangoFontDescription *font_description;
|
||||
|
||||
36
main.c
36
main.c
@@ -618,6 +618,14 @@ usage(char *argv0)
|
||||
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-press [rrggbb|aa] - Set color of text on pressed keys\n");
|
||||
fprintf(stderr,
|
||||
" --text-press-sp [rrggbb|aa] - Set color of text on pressed special keys\n");
|
||||
fprintf(stderr,
|
||||
" --text-swipe [rrggbb|aa] - Set color of text on swiped keys\n");
|
||||
fprintf(stderr,
|
||||
" --text-swipe-sp [rrggbb|aa] - Set color of text on swiped special keys\n");
|
||||
fprintf(stderr,
|
||||
" --list-layers - Print the list of available layers\n");
|
||||
fprintf(stderr,
|
||||
@@ -902,6 +910,34 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.schemes[1].text.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text-press")) ||
|
||||
(!strcmp(argv[i], "--text-press"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.schemes[0].text_press.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text-press-sp")) ||
|
||||
(!strcmp(argv[i], "--text-press-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.schemes[1].text_press.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text-swipe")) ||
|
||||
(!strcmp(argv[i], "--text-swipe"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.schemes[0].text_swipe.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text-swipe-sp")) ||
|
||||
(!strcmp(argv[i], "--text-swipe-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.schemes[1].text_swipe.bgra, argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-H")) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
|
||||
Reference in New Issue
Block a user