diff options
Diffstat (limited to 'kbd.c')
-rw-r--r-- | kbd.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -26,6 +26,34 @@ struct xkb_rule_names xkb_layout = { .options = NULL, }; +void xkb_configure(void) +{ + char line[128], *m, *v, *h; + FILE *fp; + + fp = fopen("/etc/vconsole.conf", "r"); + if (!fp) + return; + while (fgets(line, sizeof(line), fp)) { + if (strncmp(line, "KEYMAP=", 7) != 0) + continue; + m = line + 7; + if (*m == '"') + m++; + if ((h = strchr(m, '\n')) != NULL) + *h = 0; + if ((h = strchr(m, '"')) != NULL) + *h = 0; + v = strchr(m, '-'); + if (v) { + *(v++) = 0; + xkb_layout.variant = strdup(v); + } + xkb_layout.layout = strdup(m); + } + fclose(fp); +} + /* ---------------------------------------------------------------------- */ struct termctrl { |