feature: layout command to change between us and fr layouts

This commit is contained in:
2025-04-18 13:56:11 +02:00
parent a14cc5df28
commit 65f08e3887
5 changed files with 53 additions and 2 deletions

View 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");
}
}

View File

@ -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)

View File

@ -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;