Skip to content

Commit

Permalink
Add VTOY_DEFAULT_KBD_LAYOUT in global control plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Mar 24, 2021
1 parent a63a41f commit 2e10aab
Show file tree
Hide file tree
Showing 18 changed files with 1,750 additions and 11 deletions.
795 changes: 795 additions & 0 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/term/keyboard_layout.c

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion GRUB2/MOD_SRC/grub-2.04/grub-core/term/setkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,38 @@ grub_cmd_setkey (grub_extcmd_context_t ctxt, int argc, char **args)
return grub_errno;
}

static grub_extcmd_t cmd;
static void grub_keymap_add_by_string(const char *src, const char *dst)
{
int in = 0;
int out = 0;

in = parse_key(dst);
out = parse_key(src);

if (in && out)
{
grub_keymap_add (in, out);
}
}

#include "keyboard_layout.c"

static grub_err_t grub_cmd_set_keylayout (grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
ventoy_set_keyboard_layout(args[0]);
return 0;
}

static grub_extcmd_t cmd, setcmd;

GRUB_MOD_INIT(setkey)
{
cmd = grub_register_extcmd ("setkey", grub_cmd_setkey, 0, N_("NEW_KEY USA_KEY"),
N_("Map default USA_KEY to NEW_KEY."), options);
setcmd = grub_register_extcmd ("set_keyboard_layout", grub_cmd_set_keylayout, 0, N_("layout"),
N_("Set keyboard layout."), NULL);
}

GRUB_MOD_FINI(setkey)
Expand Down
1 change: 1 addition & 0 deletions INSTALL/grub/arm64-efi/command.lst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*save_env: loadenv
*search: search
*serial: serial
*set_keyboard_layout: setkey
*setkey: setkey
*sha1sum: hashsum
*sha256sum: hashsum
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/arm64-efi/moddep.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
videotest: font video gfxmenu
setkey: extcmd
odc: archelp
loopback: extcmd
setkey: extcmd
macho:
gcry_des: crypto
memrw: extcmd
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/debug.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

source $prefix/keyboard.cfg.gz
source $prefix/keyboard.cfg

submenu "Resolution Configuration" --class=debug_resolution {
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
Expand Down
3 changes: 3 additions & 0 deletions INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,9 @@ else
terminal_output gfxterm
fi
if [ -n "$VTOY_DEFAULT_KBD_LAYOUT" ]; then
set_keyboard_layout "$VTOY_DEFAULT_KBD_LAYOUT"
fi
if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
clear
Expand Down
1 change: 1 addition & 0 deletions INSTALL/grub/i386-efi/command.lst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*save_env: loadenv
*search: search
*serial: serial
*set_keyboard_layout: setkey
*setkey: setkey
*setpci: setpci
*sha1sum: hashsum
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/i386-efi/moddep.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
videotest: font video gfxmenu
setkey: extcmd
odc: archelp
loopback: extcmd
setkey: extcmd
macho:
gcry_des: crypto
memrw: extcmd
Expand Down
1 change: 1 addition & 0 deletions INSTALL/grub/i386-pc/command.lst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*search: search
*sendkey: sendkey
*serial: serial
*set_keyboard_layout: setkey
*setkey: setkey
*setpci: setpci
*sha1sum: hashsum
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/i386-pc/moddep.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
videotest: font video gfxmenu
setkey: extcmd
odc: archelp
loopback: extcmd
setkey: extcmd
macho:
gcry_des: crypto
memrw: extcmd
Expand Down
62 changes: 62 additions & 0 deletions INSTALL/grub/keyboard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
submenu "Keyboard Layouts" --class=debug_krdlayout {
menuentry QWERTY_USA --class=debug_kbd {
set_keyboard_layout QWERTY_USA
}
menuentry AZERTY --class=debug_kbd {
set_keyboard_layout AZERTY
}
menuentry CZECH_QWERTY --class=debug_kbd {
set_keyboard_layout CZECH_QWERTY
}
menuentry CZECH_QWERTZ --class=debug_kbd {
set_keyboard_layout CZECH_QWERTZ
}
menuentry DANISH --class=debug_kbd {
set_keyboard_layout DANISH
}
menuentry DVORAK_USA --class=debug_kbd {
set_keyboard_layout DVORAK_USA
}
menuentry FRENCH --class=debug_kbd {
set_keyboard_layout FRENCH
}
menuentry GERMAN --class=debug_kbd {
set_keyboard_layout GERMAN
}
menuentry ITALIANO --class=debug_kbd {
set_keyboard_layout ITALIANO
}
menuentry JAPAN_106 --class=debug_kbd {
set_keyboard_layout JAPAN_106
}
menuentry LATIN_USA --class=debug_kbd {
set_keyboard_layout LATIN_USA
}
menuentry PORTU_BRAZIL --class=debug_kbd {
set_keyboard_layout PORTU_BRAZIL
}
menuentry QWERTY_UK --class=debug_kbd {
set_keyboard_layout QWERTY_UK
}
menuentry QWERTZ --class=debug_kbd {
set_keyboard_layout QWERTZ
}
menuentry QWERTZ_HUN --class=debug_kbd {
set_keyboard_layout QWERTZ_HUN
}
menuentry QWERTZ_SLOV_CROAT --class=debug_kbd {
set_keyboard_layout QWERTZ_SLOV_CROAT
}
menuentry SPANISH --class=debug_kbd {
set_keyboard_layout SPANISH
}
menuentry SWEDISH --class=debug_kbd {
set_keyboard_layout SWEDISH
}
menuentry TURKISH_Q --class=debug_kbd {
set_keyboard_layout TURKISH_Q
}
menuentry VIETNAMESE --class=debug_kbd {
set_keyboard_layout VIETNAMESE
}
}
Binary file removed INSTALL/grub/keyboard.cfg.gz
Binary file not shown.
Binary file modified INSTALL/grub/mips64el-efi/command.lst
Binary file not shown.
Binary file modified INSTALL/grub/mips64el-efi/moddep.lst
Binary file not shown.
1 change: 1 addition & 0 deletions INSTALL/grub/x86_64-efi/command.lst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*save_env: loadenv
*search: search
*serial: serial
*set_keyboard_layout: setkey
*setkey: setkey
*setpci: setpci
*sha1sum: hashsum
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/x86_64-efi/moddep.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
videotest: font video gfxmenu
setkey: extcmd
odc: archelp
loopback: extcmd
setkey: extcmd
macho:
gcry_des: crypto
memrw: extcmd
Expand Down
Loading

0 comments on commit 2e10aab

Please sign in to comment.