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}},
|
.high = {.bgra = {100, 100, 100, transparency}},
|
||||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||||
.text = {.color = UINT32_MAX},
|
.text = {.color = UINT32_MAX},
|
||||||
|
.text_press = {.color = UINT32_MAX},
|
||||||
|
.text_swipe = {.color = UINT32_MAX},
|
||||||
.font = DEFAULT_FONT,
|
.font = DEFAULT_FONT,
|
||||||
.rounding = DEFAULT_ROUNDING,
|
.rounding = DEFAULT_ROUNDING,
|
||||||
},
|
},
|
||||||
@@ -23,6 +25,8 @@ struct clr_scheme schemes[] = {
|
|||||||
.fg = {.bgra = {32, 32, 32, transparency}},
|
.fg = {.bgra = {32, 32, 32, transparency}},
|
||||||
.high = {.bgra = {100, 100, 100, transparency}},
|
.high = {.bgra = {100, 100, 100, transparency}},
|
||||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||||
|
.text_press = {.color = UINT32_MAX},
|
||||||
|
.text_swipe = {.color = UINT32_MAX},
|
||||||
.text = {.color = UINT32_MAX},
|
.text = {.color = UINT32_MAX},
|
||||||
.font = DEFAULT_FONT,
|
.font = DEFAULT_FONT,
|
||||||
.rounding = DEFAULT_ROUNDING,
|
.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:
|
case Unpress:
|
||||||
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||||
scheme->fg, scheme->rounding);
|
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;
|
break;
|
||||||
case Press:
|
case Press:
|
||||||
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
draw_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||||
scheme->high, scheme->rounding);
|
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;
|
break;
|
||||||
case Swipe:
|
case Swipe:
|
||||||
draw_over_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
draw_over_inset(kb->surf, k->x, k->y, k->w, k->h, KBD_KEY_BORDER,
|
||||||
scheme->swipe, scheme->rounding);
|
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;
|
break;
|
||||||
}
|
default:
|
||||||
|
|
||||||
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
||||||
KBD_KEY_BORDER, label, scheme->font_description);
|
KBD_KEY_BORDER, label, scheme->font_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (type == Press || type == Unpress) {
|
if (type == Press || type == Unpress) {
|
||||||
kbd_clear_last_popup(kb);
|
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);
|
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,
|
draw_inset(kb->popup_surf, k->x, kb->last_popup_y, k->w, k->h,
|
||||||
KBD_KEY_BORDER, scheme->high, scheme->rounding);
|
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,
|
k->w, k->h, KBD_KEY_BORDER, label,
|
||||||
scheme->font_description);
|
scheme->font_description);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ struct clr_scheme {
|
|||||||
Color high;
|
Color high;
|
||||||
Color swipe;
|
Color swipe;
|
||||||
Color text;
|
Color text;
|
||||||
|
Color text_press;
|
||||||
|
Color text_swipe;
|
||||||
char *font;
|
char *font;
|
||||||
int rounding;
|
int rounding;
|
||||||
PangoFontDescription *font_description;
|
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 [rrggbb|aa] - Set color of text on keys\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" --text-sp [rrggbb|aa] - Set color of text on special keys\n");
|
" --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,
|
fprintf(stderr,
|
||||||
" --list-layers - Print the list of available layers\n");
|
" --list-layers - Print the list of available layers\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -902,6 +910,34 @@ main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
set_kbd_colors(keyboard.schemes[1].text.bgra, argv[++i]);
|
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")) {
|
} else if (!strcmp(argv[i], "-H")) {
|
||||||
if (i >= argc - 1) {
|
if (i >= argc - 1) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user