feature: layout command to change between us and fr layouts
This commit is contained in:
parent
a14cc5df28
commit
65f08e3887
@ -10,3 +10,4 @@ void reboot_cmd(char *arg);
|
||||
void heap_cmd(char *arg);
|
||||
void clear_cmd(char *arg);
|
||||
void merdella_cmd(char *arg);
|
||||
void layout_cmd(char *arg);
|
||||
|
@ -3,7 +3,35 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
[[__maybe_unused__]] static const char *keymap[128] = {
|
||||
[[__maybe_unused__]] static const char *azerty_keymap[128] = {
|
||||
[2] = "&1", [3] = "é2", [4] = "\"3", [5] = "'4", [6] = "(5",
|
||||
[7] = "-6", [8] = "è7", [9] = "_8", [10] = "ç9", [11] = "à0",
|
||||
[12] = ")°", [13] = "=+", [14] = NULL, [15] = NULL, [16] = "aA",
|
||||
[17] = "zZ", [18] = "eE", [19] = "rR", [20] = "tT", [21] = "yY",
|
||||
[22] = "uU", [23] = "iI", [24] = "oO", [25] = "pP", [26] = "^¨",
|
||||
[27] = "$£", [28] = "\n\n", [30] = "qQ", [31] = "sS", [32] = "dD",
|
||||
[33] = "fF", [34] = "gG", [35] = "hH", [36] = "jJ", [37] = "kK",
|
||||
[38] = "lL", [39] = "mM", [40] = "ù%", [41] = NULL, [42] = NULL,
|
||||
[43] = "*µ", [44] = "wW", [45] = "xX", [46] = "cC", [47] = "vV",
|
||||
[48] = "bB", [49] = "nN", [50] = ",?", [51] = ";.", [52] = ":/",
|
||||
[53] = "!§", [54] = NULL, [55] = NULL, [56] = NULL, [57] = " ",
|
||||
[58] = NULL, [59] = NULL, [60] = NULL, [61] = NULL, [62] = NULL,
|
||||
[63] = NULL, [64] = NULL, [65] = NULL, [66] = NULL, [67] = NULL,
|
||||
[68] = NULL, [69] = NULL, [70] = NULL, [71] = NULL, [72] = NULL,
|
||||
[73] = NULL, [74] = NULL, [75] = NULL, [76] = NULL, [77] = NULL,
|
||||
[78] = NULL, [79] = NULL, [80] = NULL, [81] = NULL, [82] = NULL,
|
||||
[83] = NULL, [84] = NULL, [85] = NULL, [86] = NULL, [87] = NULL,
|
||||
[88] = NULL, [89] = NULL, [90] = NULL, [91] = NULL, [92] = NULL,
|
||||
[93] = NULL, [94] = NULL, [95] = NULL, [96] = NULL, [97] = NULL,
|
||||
[98] = NULL, [99] = NULL, [100] = NULL, [101] = NULL, [102] = NULL,
|
||||
[103] = NULL, [104] = NULL, [105] = NULL, [106] = NULL, [107] = NULL,
|
||||
[108] = NULL, [109] = NULL, [110] = NULL, [111] = NULL, [112] = NULL,
|
||||
[113] = NULL, [114] = NULL, [115] = NULL, [116] = NULL, [117] = NULL,
|
||||
[118] = NULL, [119] = NULL, [120] = NULL, [121] = NULL, [122] = NULL,
|
||||
[123] = NULL, [124] = NULL, [125] = NULL, [126] = NULL, [127] = NULL,
|
||||
};
|
||||
|
||||
[[__maybe_unused__]] static const char *qwerty_keymap[128] = {
|
||||
[2] = "1!", [3] = "2@", [4] = "3#", [5] = "4$", [6] = "5%",
|
||||
[7] = "6^", [8] = "7&", [9] = "8*", [10] = "9(", [11] = "0)",
|
||||
[12] = "-_", [13] = "=+", [14] = NULL, [15] = NULL, [16] = "qQ",
|
||||
|
19
src/shell/commands/layout_cmd.c
Normal file
19
src/shell/commands/layout_cmd.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "keyboard.h"
|
||||
#include "kprintf.h"
|
||||
#include "string.h"
|
||||
|
||||
extern char const **keymap;
|
||||
|
||||
void layout_cmd(char *arg)
|
||||
{
|
||||
if (!strcmp(arg, "us") || !strcmp(arg, "qwerty")) {
|
||||
kprintf("Successfully changed layout to us/qwerty\n");
|
||||
keymap = qwerty_keymap;
|
||||
} else if (!strcmp(arg, "fr") || !strcmp(arg, "azerty")) {
|
||||
kprintf("Successfully changed layout to fr/azerty\n");
|
||||
keymap = azerty_keymap;
|
||||
} else {
|
||||
kprintf(
|
||||
"Invalid argument: please type us|qwerty or fr|azerty\n");
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ const struct shell_command cmds[] = {
|
||||
{"date", "Display the current time and date", date_cmd},
|
||||
{"merdella", "Surprise", merdella_cmd},
|
||||
{"color", "Change the screen color", color_cmd},
|
||||
{"layout", "Change the current layout (us or fr)", layout_cmd},
|
||||
};
|
||||
|
||||
#define NB_CMDS ARRAY_SIZE(cmds)
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "sys/io.h"
|
||||
#include "terminal.h"
|
||||
|
||||
char const **keymap = qwerty_keymap;
|
||||
|
||||
struct key_event terminal_getkey(void)
|
||||
{
|
||||
static bool caps_mode = false;
|
||||
|
Loading…
Reference in New Issue
Block a user