feature: layout command to change between us and fr layouts
This commit is contained in:
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;
|
||||
|
||||
Reference in New Issue
Block a user