Jump to content











Photo
- - - - -

Easy way to change keyboard layout/language on grub4dos command line

grub4dos keyboard lang

  • Please log in to reply
10 replies to this topic

#1 alacran

alacran

    Gold Member

  • .script developer
  • 1122 posts
  •  
    Mexico

Posted 2 weeks ago

Since long time ago I have had troubles with my non English keyboard in grub4dos command line, it is really APITA to type some commands with an Spanish (es-ES) or Latinamerican (es-LA) keyboard, steve6375 recommended me long time ago to copy from his great tool E2B the keyboard file(s) for my KB, E2B contains several keyboard options on Easy2Boot\_ISO\e2b\grub\ folder, and I did it, but always forget to add the required file, or its name is hard to type once on command line.

List of Keyboard batch files available on E2B:

Spoiler


I finally decided to put an end to this stupid issue and did the following:

 

Copied: KBD_SPANISH.g4b, KBD_LATIN_USA.g4b and KBD_QWERTY_USA.g4b next to my grld and menu.lst files

 

And renamed them to: eses.g4b, esla.g4b and enus.g4b, respectively

 

Added a title to my menu.lst as shown:

title Grub4Dos Command Line\nOn command line Type eses + ENTER for es-ES KB\nType esla + ENTER for es-LA KB\nType enus + ENTER for en-US KB
command --set-ext=.g4b > nul
commandline

I know en-US is default keyboard on grub4dos but I added it just in case after using es-ES or es-LA KB(s) I want to go back to the default keyboard, without the need to reboot.

 

Now KB batch files (.g4b) names make more sence to me, are shorter, easy to remember and very much easier to type, as there is not any "_" or "-" caracter on any of them, wich are located on different places/keys on this KBs.

 

Of course each user will select the required file(s) and rename the way he/she wants, just remember to edit the entrance on menu.lst as required.

 

This is in fact something not very technical, but I wanted to share it because it seems to me very simple and practical, and maybe it can be of some use for new grub4dos users.

 

Locale ID: https://docs.microso...-language-packs

 

Also if there isn't available a keyboard .g4b file for your language, you can make your own using as a guide KBD_QWERTY_USA.g4b, KBD_QWERTY_UK.g4b and this page where you can take a look of many keyboard layouts: http://kbdlayout.info/

 

EDIT: For updated version see post No. 6 please.

 

alacran


Edited by alacran, 2 weeks ago.

  • wimb and ReTokener like this

#2 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 191 posts

Posted 2 weeks ago

Hola my friend,

brilliant idea!

thanks a lot for sharing.

Thanks to steve6375 too, of course.

 

Regards   T.



#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 7075 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 2 weeks ago

title Spanish keyboard\nChange to Spanish keyboard
call /kbd_spanish.g4b
errorcheck off
boot

Simples!

 

[Edited /n to \n]


Edited by steve6375, 2 weeks ago.

  • wimb and ReTokener like this

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15060 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 2 weeks ago

It seems more logical to me something "midway".

I.e., since the keyboard remapping is only useful when you need to type something (the keys used for menu navigation/choices are not remapped AFAICR), maybe:

 

title Command Line - Spanish Keyboard

call /kbd_spanish.g4b
commandline

 

and possibly:

 

title Command Line - US Keyboard

call /kbd_qwerty_usa.g4b
commandline

might do? :unsure:

 

:duff:

Wonko



#5 steve6375

steve6375

    Platinum Member

  • Developer
  • 7075 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 2 weeks ago

If using grub4dos 'hotkey' utility, then any letter key you type will highlight the next menu item beginning with that same letter.

You can also set up hotkeys such as Ctrl-Z, etc., so the correct keyboard type is essential.

Also entering the menu password is tricky if the keyboard is not correct, depending on what password has been set (e.g. 'easy2boot' when you have a German QWERTZ keyboard!)

 

P.S. Recent grub4dos 0.4.6a has enhanced kbd mapping of more keys than older versions and the E2B KEY_xxx files have been enhanced.


Edited by steve6375, 2 weeks ago.


#6 alacran

alacran

    Gold Member

  • .script developer
  • 1122 posts
  •  
    Mexico

Posted 2 weeks ago

title Spanish keyboard/nChange to Spanish keyboard
call /kbd_spanish.g4b
errorcheck off
boot

Simples!

 

Using this approach you change the keyboard without run the commandline, wich could be usefull in some scenarios (not my case right now). Of course we will need another title to run commandline:

 

title Command Line

commandline

 

EDIT: Not required unless the KB don't have "c" key on same possition as on en-US KB, just pressining "c" key will open Command Line.

 

Also there is a little mistake on first line/title (I assume it was a typo from steve6375), it should be:

 

title Spanish keyboard\nChange to Spanish keyboard   >>> It needs to be backslash to be written as a help message at the bottom part of screen.

 

 

It seems more logical to me something "midway".

I.e., since the keyboard remapping is only useful when you need to type something (the keys used for menu navigation/choices are not remapped AFAICR), maybe:

 

title Command Line - Spanish Keyboard

call /kbd_spanish.g4b
commandline

 

and possibly:

 

title Command Line - US Keyboard

call /kbd_qwerty_usa.g4b
commandline

might do? :unsure:

 

:duff:

Wonko

 

This will change the keyboard and open commandline, wich sounds good as usualy is on command line where we need to type something more frecuently, but once on commandline we will have to type the long name of the batch file if we want to change for another KB.

 

Maybe this could be more useful:

title Command Line with Spanish KB\nTo change KB when on command line Type eses + ENTER for es-ES KB\nType esla + ENTER for es-LA KB or Type enus + ENTER for en-US KB
command --set-ext=.g4b > nul
call /eses.g4b
commandline

This will change KB before open commandline, and also has the additional benefit of use short names for KB batch files, easier to remember and type on commandline if for some reason we want to change the KB there.

 

But I think as always this is only a matter of preference of each user, the options are available for selecting what fits better his/hers needs/likes.

 

NOTE: On my country almost all OEM laptops and desktops come with es-LA KB, but if you go to the store to buy a single KB, only option is es-ES KB, so it is very frecuent to find a mix of KBs everywhere, in fact I do have a mix of KBs at home, and it is always good to have options to change the KB layout/language from the menu and also from the commandline.

 

alacran



#7 alacran

alacran

    Gold Member

  • .script developer
  • 1122 posts
  •  
    Mexico

Posted 2 weeks ago

New info added to first post to help create other Keyboard layouts/languages batch files in case the required one is not available on E2B.

 

Let me suggest if some of you have sucess creating a new keyboard file and after testing it all work fine, to make a post and attach it or put a link to a free hosting service to make it available to other users.

 

alacran



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15060 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 2 weeks ago

Oww, come on ...

 

 

I don't get you :wacko:  (but as always it is fine :) ).

 

The only reason (apart the added complication of hotkeys AND IF one of the hotkeys is one of the remapped chars) for having a localized keyboard is to manually type some commands, if you have under your hands a Spanish keyboard AND you want to run something on command line (AND you are not able to type those on the US keyboard mapping ) then you open, instead of a plain command line "c", the menu entry for Spanish keyboard.

 

Once you have done that you have not one reason on earth to revert to the US one, but even if you have - as a matter of fact - you can press "e" and choose the "other" command line entry remapping to the US keyboard and press "e" or, even if you do not have to remember the name of the .g4b file, while still on the command line you type:

call /kbd [TAB]

and you will have a list of all files starting with kbd[1] you have available, among them /poossibly only two or three) it shouldn't be that difficult to complete, by alternating jey presses to [TAB]s to the wanted one.

 

BTW, if you actually "call" a .g4b, I don't think you need to "command --set-ext=.g4b > nul"

 

 

:duff:

Wonko

 

[1] and this alone is a very good reason to have all files starting with kbd



#9 alacran

alacran

    Gold Member

  • .script developer
  • 1122 posts
  •  
    Mexico

Posted 2 weeks ago

As said on first post:

 

 

maybe it can be of some use for new grub4dos users

 

Of course it can be done in several different ways, but as the title of the posts says:

 

 

Easy way to change keyboard layout/language on grub4dos command line

 

About the use of hotkeys: This thread was made for user made menus not for E2B (great work of steve6375 by the way) or any other premade solution,  Additionaly to let hotkeys to work It requires to download an additional file and follow some steps to make it work, then the user should follow the instructions to use it, and be sure to not have any possible interference with his/hers renamed (if used this suggestion) files.

 

About this line:

 

 

command --set-ext=.g4b > nul

 

It let you use the short names without extension when on Command Line, but if next line on menu is:

 

call /eses

 

It do not work when you are on the menu, it is not executed/accepted and there is no change on KB layout when Command line is loaded. Then on the menu I had to add the extension to let it work properly, as following:

 

 

call /eses.g4b

 

Now, this way it is accepted and Command Line is opened with the new KB layout, then having both lines give the user the capability to change KB on menu.lst and also when on Command Line.

 

And just to finish this post, also as said before:

 

 

But I think as always this is only a matter of preference of each user, the options are available for selecting what fits better his/hers needs/likes.

 

alacran



#10 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15060 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 2 weeks ago

Sure :)

call /eses

doesn't work, because the filename  is eses.g4b BUT you are not on command line so it doesn't cost you much to add to write in the menu entry:

call /eses.g4b

OR since you are renaming files, nothing prevents you from calling it only eses.

 

The point I was trying to explain was that that setting the extension to executable allows for having "directly":

command --set-ext=.g4b > nul
/eses.g4b

 

BUT this:

call /eses.g4b

should work nonetheless by itself.

 

I will repeat, however that on command line one needs to gt the habit of using the very handy [TAB] autocompletion, so that:

call /es[TAB]

will autocomplete properly to the filename. 

 

Anyway, at the time I made a simple spreadsheet to create "custom" (or localized) keyboard layouts for grubdos, while it may be far from perfect is a good base if someone wants to experiment, only for the record:

 

http://reboot.pro/to...eyboard-layout/

http://reboot.pro/to...layout/?p=68522

 

:duff:

Wonko



#11 steve6375

steve6375

    Platinum Member

  • Developer
  • 7075 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 2 weeks ago

Here is a recent blog article on the latest keyboard changes to grub4dos.

https://rmprepusb.bl...-keyboards.html

When making grub4dos keyboard translation files, I found it easiest to just get the two keyboards up in two browser tabs.

Then you simply look at the differences for each key in turn in each state.

First choose the 'Shift states' - 'Base' views  (i.e. unshifted)...

http://kbdlayout.inf...irtualkeys/base

http://kbdlayout.inf...irtualkeys/base

Now compare each key and create a setkey line for any difference using

setkey [new character] [QWERTY-USA character]

Next change to 'VK_Shift' in both browser tabs to show the Shift-state of each key and compare the two browser windows and write more setkey lines.

Next change to 'VK_Control' and do those

Next change to 'VK_Control,VK_Menu' for the Ctrl+Alt (=AltGr) special keys

 

Check the E2B KBD_ files to see examples.







Also tagged with one or more of these keywords: grub4dos, keyboard lang

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users