FedoraForum.org - Fedora Support Forums and Community
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2009
    Location
    Lancaster, UK
    Posts
    932
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change keyboard layout and remap key.

    I cannot quite figure out how to change the keyboard layout to British English and to remap Cap Locks to be an additional Ctrl key.

    I have done this through the GUI's but would like to know how to do this via the command line.

    Also, I am approaching this from the point of view of a minimal install, so the less I need to install do to this the better.

    As always though this is linux and there are many ways to do everything, so I luck forward to reading as many as possible (CLI only though ).

  2. #2
    Join Date
    Mar 2005
    Location
    Brisbane, Australia
    Age
    54
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and have it applied 100% systemwide.

    I'm also trying to figure out how to change the default (run level 3 & login screen keyboard layout.

    Currently I use Colemak but this isn't set as default until it is applied AFTER logging into Gnome 3.

    Does anyone know how to have your preferred keyboard layout set so that it apples at system / run level 3 / grub2 when you compile grub 2 / and the login screen?

  3. #3
    Join Date
    Nov 2007
    Location
    Berkeley, California
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and remap key.

    Quote Originally Posted by Adunaic
    I cannot quite figure out how to change the keyboard layout to British English and to remap Cap Locks to be an additional Ctrl key.

    I have done this through the GUI's but would like to know how to do this via the command line.

    Also, I am approaching this from the point of view of a minimal install, so the less I need to install do to this the better.

    As always though this is linux and there are many ways to do everything, so I luck forward to reading as many as possible (CLI only though ).
    I suppose you mean keymaps for use in applications that are X clients, not in Linux console.

    I'll give you two examples: first, a simple one. The following alias is in my ~/.bashrc to be used in desktop environments like fluxbox and Openbox:

    Code:
    alias ERP="setxkbmap -layout 'us,pl,ru' -variant 'altgr-intl,,phonetic' -option grp:alt_shift_toggle"
    Executing it at the command line sets three keymaps in use: US International with combinations of AltGr and the accents serving as dead keys, Polish, and Russian (so called 'phonetic'; it is often referred as the 'yawerty' keymap, since pressing 'q' outputs Russian letter я ; this command also sets the combination Alt+Shift as the 'toggle' key: pressing it repeatedly cycles through the keymaps that are being selected.

    Now, a more complex example:

    Code:
    alias ERP="setxkbmap -I$HOME/.xkb -layout 'us,pl_MW,ru_MW' -variant 'altgr-intl,,' -option grp:alt_shift_toggle -print | xkbcomp -I$HOME/.xkb - $DISPLAY 2>/dev/null"
    It is an elaboration of the previous example with two keymaps being replaced by their modifications; I placed the latter in directory ~/.xkb/symbols.

    I had to use a different syntax only due to essentially buggy nature of the sexkbmap command. This last command would by the way not work in CentOS 5.*, it has been working in Fedora 14, 15, and 16.

    ---------- Post added at 01:43 PM ---------- Previous post was at 01:15 PM ----------

    Quote Originally Posted by synic
    I'm also trying to figure out how to change the default (run level 3 & login screen keyboard layout.

    Currently I use Colemak but this isn't set as default until it is applied AFTER logging into Gnome 3.
    That's true. I complained about it soon after Fedora 16 had been released and Adam Williamson provided some information about this change from previous versions of the login screen.

    Quote Originally Posted by synic
    Does anyone know how to have your preferred keyboard layout set so that it apples at system / run level 3 / grub2 when you compile grub 2 / and the login screen?
    Modify the corresponding fields in the /etc/sysconfig/etc/sysconfig file.

    If, additionally, you want to change the Linux console font and the locale, then modify the corresponding fields in the /etc/sysconfig/i18 file. Finally, if you would like the font and the Linux console keymap (different from keymaps for X clients) to be changed already at boot, then modify the corresponding entries in the /etc/default/grub file and, subsequently, issue the command

    Code:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    Last edited by Mariusz W; 26th November 2011 at 11:02 PM.

  4. #4
    Join Date
    Mar 2005
    Location
    Brisbane, Australia
    Age
    54
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and remap key.

    Quote Originally Posted by Mariusz W
    I suppose you mean keymaps for use in applications that are X clients, not in Linux console.
    ...
    I'm not actually sure what that means. Sorry. I mean that sometimes when boot, or login fails; prior to the login screen for either Gnome or KDE, you will be dropped at a command line which I believe is run level 3. You just have a bash prompt, sometime networking; but X isn't running ie: no pretty graphical user interface.

    When this happens, and you just have a black screen and bash, the keyboard layout is always in Qwerty. I want it to default to Colemak; so that I can type properly when trouble shooting, and also so that when Gnome 3 fails and I get dropped back to the login screen, again, I can just type in Colemak ranther than having to single finger poke in order to get the keys right.

    I have two keyboard layouts enabled in Gnome and just switch between the 2 with a hotkey that my wife 'has now come to terms with and can use' (she uses Qwerty).

    I'm KNOW it must be supported / possible, somehow.

    I'm under the impression that if I run: grub2-mkconfig -o /boot/grub2/grub.cfg, the default keyboard layout is pulled from the settings in /etc/default/grub; and that is why my keytable is always in Keytable=us.

    I am now running a fresh install because yesterday I hosed my system mucking around with the keytable settings in /etc/default/grub. And it didn't work, and, I'm actually not sure why.

    Anyway, after stuffing around for about 2 hours and getting nowhere (because my VI skills arn't the best) I decided to just reinstall. Its a crappy way to go about because I know it should be relatively easy to fix.

    Quote Originally Posted by Mariusz W
    ...
    I had to use a different syntax only due to essentially buggy nature of the sexkbmap command. This last command would by the way not work in CentOS 5.*, it has been working in Fedora 14, 15, and 16.

    ---------- Post added at 01:43 PM ---------- Previous post was at 01:15 PM ----------

    When I ran setkbmap not a whole lot happened other than toggling between the Colemak and Qwerty us layouts I had already set.

    Quote Originally Posted by Mariusz W
    That's true. I complained about it soon after Fedora 16 had been released and Adam Williamson provided some information about this change from previous versions of the login screen.
    Do you know if this is fixed? (Sorry, I realise that is what we are getting to in the next point.)

    Quote Originally Posted by Mariusz W
    Modify the corresponding fields in the /etc/sysconfig/etc/sysconfig file.

    If, additionally, you want to change the Linux console font and the locale, then modify the corresponding fields in the /etc/sysconfig/i18 file. Finally, if you would like the font and the Linux console keymap (different from keymaps for X clients) to be changed already at boot, then modify the corresponding entries in the /etc/default/grub file and, subsequently, issue the command
    I'm not sure of the exact layout to imput it as. The Arch Wiki lists the layout as: KEYMAP="colemak" Colemak (US) Interesting Colemak is the only layout not gz'ed.

    Although I have a funny feeling that KEYMAP and KEYTABLE are different things. In fact, I assume they are.

    Pointing me to /etc/sysconfig I believe is what I am looking for. And
    [root@study sysconfig]# cat keyboard
    KEYTABLE="us"
    MODEL="pc105+inet"
    LAYOUT="us"
    is getting close; isn't it? I'm just not sure what format I should be changing KEYTABLE="us" to before I run:

    Quote Originally Posted by Mariusz W
    Code:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    I hope that Colemak is supported at all those levels, I would have selected Colemak during the install but it isn't an option offered by Fedora during install. That was one of the reasons I used the full 3.5 gig install disk rather than a 650M live disk. I was expecting the Colemak keyboard layout to be an option when doing a full install. I know it is an option offered by Ubuntu. Interesting

    Where can I find the required KEYTABLE="colemak" format that will be accepted by grub2-mkconig when updating my boot parameter? And where will I change it? Is it /etc/sysconfig/keyboard?

    Thank you very much...
    Last edited by synic; 27th November 2011 at 11:29 PM.

  5. #5
    Join Date
    Nov 2007
    Location
    Berkeley, California
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and remap key.

    Quote Originally Posted by synic
    I'm not sure of the exact layout to imput it as. The Arch Wiki lists the layout as: KEYMAP="colemak" Colemak (US)

    Interesting Colemak is the only layout not gz'ed.
    I am not sure what do you mean by that: /lib/kbd/keymaps/i386/colemak is a directory, /lib/kbd/keymaps/i386/qwerty is another directory -- gzipped files in such directories correspond to layouts. There are plenty of those in the qwerty directory and just one in the colemak directory.

    Quote Originally Posted by synic
    Although I have a funny feeling that KEYMAP and KEYTABLE are different things. In fact, I assume they are.
    Be warned that certain things Arch Linux does differently from Fedora, especially setting various options during boot time.

    Quote Originally Posted by synic
    Pointing me to /etc/sysconfig I believe is what I am looking for. And
    [root@study sysconfig]# cat keyboard
    KEYTABLE="us"
    MODEL="pc105+inet"
    LAYOUT="us"
    is getting close; isn't it? I'm just not sure what format I should be changing KEYTABLE="us" to before I run: (...)
    I would try first to change /etc/sysconfig/keyboard to
    Code:
    KEYTABLE="en-latin9"
    MODEL="pc105+inet"
    LAYOUT="en-latin9"
    If this works, then
    Code:
    KEYTABLE="en-latin9"
    MODEL="pc105+inet"
    may work too.
    Last edited by Mariusz W; 28th November 2011 at 01:27 AM.

  6. #6
    Join Date
    Mar 2005
    Location
    Brisbane, Australia
    Age
    54
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and remap key.

    Sounds good. Here goes....

    I've rebooted. Still here.

    And should I change /etc/default/grub "KEYTABLE= " ??? " Or should I just leave that?
    Last edited by synic; 28th November 2011 at 12:42 AM.

  7. #7
    Join Date
    Nov 2007
    Location
    Berkeley, California
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change keyboard layout and remap key.

    Quote Originally Posted by synic
    Sounds good. Here goes....

    I've rebooted. Still here.
    I was still editing my post when you have been rebooting, re-read my post.

    Quote Originally Posted by synic
    And should I change /etc/default/grub "KEYTABLE= " ??? " Or should I just leave that?
    I would change it to

    Code:
    KEYTABLE=en-latin9
    and apply
    Code:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    afterwards.

    I would like to add, however, that I am not sure whether doing this is advisable or not if you modified /etc/sysconfig/keyboard settings anyway. I verified that by leaving the old KEYTABLE=us flag in the GRUB configuration while replacing the contents of /etc/sysconfig/keyboard with what I wrote in my previous post:
    Code:
    KEYTABLE="en-latin9"
    MODEL="pc105+inet"
    already at the console login at the init 3 level I am presented with the changed keyboard layout that I presume is the Colmak layout. Since I have absolutely no familiarity with it I couldn't type in blind the password, so I had to reboot by pressing Ctrl-Alt-Del into init 1 in order to extricate myself from an awkward situation, and to revert to the previous /etc/sysconfig/keyboard that I saved, of course, as /etc/sysconfig/keyboard.bup.
    Last edited by Mariusz W; 28th November 2011 at 03:09 AM.

Similar Threads

  1. LXDE keyboard layout change
    By ventsyv in forum Using Fedora
    Replies: 1
    Last Post: 24th September 2011, 09:51 PM
  2. [Solved] How to change the default keyboard layout?
    By misiu_mp in forum Using Fedora
    Replies: 0
    Last Post: 6th December 2010, 05:35 PM
  3. Tsclient 2.0.1 change default keyboard layout
    By xranix in forum Using Fedora
    Replies: 0
    Last Post: 23rd December 2008, 02:59 PM
  4. change keyboard layout
    By stadin in forum Hardware
    Replies: 0
    Last Post: 10th September 2007, 01:47 AM
  5. cannot change keyboard layout
    By nocturnus_gr in forum Using Fedora
    Replies: 0
    Last Post: 30th September 2004, 02:55 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •