LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-27-2014, 07:19 AM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Russian keyboard layout for the American keyboard


The interesting task is to write Russian using some non-Russian keyboard such as an American one. I designed such a keyboard layout some time ago and today I updated it.

The Russian alphabet uses 33 characters. In my keyboard layout 23 out of them are in the places according to their phonetic values. Most of the other 10 characters are in the places matching more or less their shapes. It is possible to learn to write Russian using this keyboard layout after a couple of minutes.

To get the Latin characters or the punctuation marks during writing in Russian use the right Alt + key.

I publish this keyboard layout here for your convenience. If you use some non-American keyboard such as German or French ones you have to move a few Russian characters to some other places.

ru-us
Code:
// Russian keyboard layout for the American keyboard
// designed by Cezary M. Kruk <c.kruk@bigfoot.com>

// X Window version

// put ru-us file into /etc/X11/xkb/symbols directory

// for xterm set the UTF-8 font such as:
// -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1

// to set this keymap run the command:
// setxkbmap ru-us

// for the punctuation marks or the Latin alphabet
// use the right Alt + key keyboard shortcuts

// Q  W  E  R  T  Y  U  I  O  P  [  ]
// Ь  В  Э  Р  Т  Ы  У  И  О  П  Ш  Щ
//
//  A  S  D  F  G  H  J  K  L  ;  '  
//  А  С  Д  Ф  Г  Х  Й  К  Л  Ё  Ю  
//
//   Z  X  C  V  B  N  M  ,  .  /    
//   З  Ж  Ц  Ч  Б  Н  М  Я  Е  Ъ    
//

partial default alphanumeric_keys

xkb_symbols "common" {

    key <TLDE> { [             grave,        asciitilde  ] };

    key <AE01> { [                 1,            exclam  ] };
    key <AE02> { [                 2,                at  ] };
    key <AE03> { [                 3,        numbersign  ] };
    key <AE04> { [                 4,            dollar  ] };
    key <AE05> { [                 5,           percent  ] };
    key <AE06> { [                 6,       asciicircum  ] };
    key <AE07> { [                 7,         ampersand  ] };
    key <AE08> { [                 8,          asterisk  ] };
    key <AE09> { [                 9,         parenleft  ] };
    key <AE10> { [                 0,        parenright  ] };
    key <AE11> { [             minus,        underscore  ] };
    key <AE12> { [             equal,              plus  ] };

    key <AD01> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN,            q,          Q ] };
    key <AD02> { [       Cyrillic_ve,       Cyrillic_VE,            w,          W ] };
    key <AD03> { [        Cyrillic_e,        Cyrillic_E,            e,          E ] };
    key <AD04> { [       Cyrillic_er,       Cyrillic_ER,            r,          R ] };
    key <AD05> { [       Cyrillic_te,       Cyrillic_TE,            t,          T ] };
    key <AD06> { [     Cyrillic_yeru,     Cyrillic_YERU,            y,          Y ] };
    key <AD07> { [        Cyrillic_u,        Cyrillic_U,            u,          U ] };
    key <AD08> { [        Cyrillic_i,        Cyrillic_I,            i,          I ] };
    key <AD09> { [        Cyrillic_o,        Cyrillic_O,            o,          O ] };
    key <AD10> { [       Cyrillic_pe,       Cyrillic_PE,            p,          P ] };
    key <AD11> { [      Cyrillic_sha,      Cyrillic_SHA,  bracketleft,  braceleft ] };
    key <AD12> { [    Cyrillic_shcha,    Cyrillic_SHCHA, bracketright, braceright ] };

    key <BKSL> { [         backslash,               bar  ] };

    key <AC01> { [        Cyrillic_a,        Cyrillic_A,            a,          A ] };
    key <AC02> { [       Cyrillic_es,       Cyrillic_ES,            s,          S ] };
    key <AC03> { [       Cyrillic_de,       Cyrillic_DE,            d,          D ] };
    key <AC04> { [       Cyrillic_ef,       Cyrillic_EF,            f,          F ] };
    key <AC05> { [      Cyrillic_ghe,      Cyrillic_GHE,            g,          G ] };
    key <AC06> { [       Cyrillic_ha,       Cyrillic_HA,            h,          H ] };
    key <AC07> { [   Cyrillic_shorti,   Cyrillic_SHORTI,            j,          J ] };
    key <AC08> { [       Cyrillic_ka,       Cyrillic_KA,            k,          K ] };
    key <AC09> { [       Cyrillic_el,       Cyrillic_EL,            l,          L ] };
    key <AC10> { [       Cyrillic_io,       Cyrillic_IO,    semicolon,      colon ] };
    key <AC11> { [       Cyrillic_yu,       Cyrillic_YU,   apostrophe,   quotedbl ] };

    key <AB01> { [       Cyrillic_ze,       Cyrillic_ZE,            z,          Z ] };
    key <AB02> { [      Cyrillic_zhe,      Cyrillic_ZHE,            x,          X ] };
    key <AB03> { [      Cyrillic_tse,      Cyrillic_TSE,            c,          C ] };
    key <AB04> { [      Cyrillic_che,      Cyrillic_CHE,            v,          V ] };
    key <AB05> { [       Cyrillic_be,       Cyrillic_BE,            b,          B ] };
    key <AB06> { [       Cyrillic_en,       Cyrillic_EN,            n,          N ] };
    key <AB07> { [       Cyrillic_em,       Cyrillic_EM,            m,          M ] };
    key <AB08> { [       Cyrillic_ya,       Cyrillic_YA,        comma,       less ] };
    key <AB09> { [       Cyrillic_ie,       Cyrillic_IE,       period,    greater ] };
    key <AB10> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN,        slash,   question ] };

    key.type[group1]="TWO_LEVEL";

    include "level3(ralt_switch)"
};
In order to use the above keyboard layout put ru-us file into /etc/X11/xkb/symbols directory and use the command setxkbmap ru-us.

Have fun!

***

(I moved this post from This is my Slackware desktop... thread here for the better exposure.)

Last edited by w1k0; 12-30-2014 at 12:39 AM.
 
Old 12-28-2014, 04:12 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,193
Blog Entries: 24

Rep: Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159
Thanks, I have saved your keymap file (although I have not yet tried it).

Earlier this year I adapted my own systems to include a Russian keymap, with terrific help from LQ members here.

I agree, a phonetic layout was easiest and most helpful to myself using an American keyboard. I settled on a modified "Yawerty" layout created by bormant, and now happily type по-русски whenever needed (I wish my grasp of the language were this easy!).

I tried the "Йцукен" layout briefy, but without a genuine Russian keyboard it wasn't practical, for myself anyway.

Yours is very similar to "Yawerty" layout, but also includes significant differences. Thanks for sharing that!

Last edited by astrogeek; 12-30-2014 at 01:17 PM. Reason: Итсукен -> Йцукен, phonetics!
 
1 members found this post helpful.
Old 12-29-2014, 02:54 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
Thank you for the link to your thread. So far I prepared the Russian keyboard layout for X Window. Tomorrow I will prepare the same keyboard layout for the console and I will publish it here.

I wrote my keyboard layout in the middle of 2013 just to use it with some Russian dictionaries so I ignored the punctuation marks then. Before publishing this keyboard layout here I updated it and now it is possible to use the punctuation as well. I added also the possibility to write occasionally some Latin characters.

Earlier I was forced to switch the keyboard layout in order to write some command. With my Window Maker it is easy: Alt + Shift + 5 keyboard shortcut activates the Russian keyboard layout while Alt + Shift + 8 keyboard shortcut activates the Polish UTF-8 keyboard layout.

***

The yawerty keyboard layout is the following:

Code:
`  1  2  3  4  5  6  7  8  9  0  -  =
Ю  1  2  3  4  5  6  7  8  9  0  -  Ч

    Q  W  E  R  T  Y  U  I  O  P  [  ]  \
    Я  В  Е  Р  Т  Ы  У  И  О  П  Ш  Щ  Э

     A  S  D  F  G  H  J  K  L  ;  '  
     A  С  Д  Ф  Г  Х  Й  К  Л  ;  '  

      Z  X  C  V  B  N  M  ,  .  /    
      З  Ь  Ц  Ж  Б  Н  М  ,  .  /
My keyboard layout is the following:

Code:
 Q  W  E  R  T  Y  U  I  O  P  [  ]
 Ь  В  Э  Р  Т  Ы  У  И  О  П  Ш  Щ

  A  S  D  F  G  H  J  K  L  ;  '  
  А  С  Д  Ф  Г  Х  Й  К  Л  Ё  Ю  

   Z  X  C  V  B  N  M  ,  .  /    
   З  Ж  Ц  Ч  Б  Н  М  Я  Е  Ъ
It seems to me that in the yawerty keyboard layout there is no Ё and Ъ characters. Moreover Э is not in the place according to its phonetic value because it is occupied by Е. It seems to me also that it is easier to memorize the location of a few other characters using my keyboard layout. As a result I prefer my keyboard layout.

***

With the yawerty keyboard layout Alt + Shift works as a switch changing the keyboard layouts.

With my keyboard layout it works the other way. For example:

● to get я you press ,
● to get Я you press Shift + ,
● to get , you press Alt + ,
● and to get < you press Alt + Shift + ,

So in my keyboard layout the Russian alphabet has a precedence over the Latin alphabet.

In order to get the keyboard layout in which the Latin alphabet precedes the Russian one it is enough to swap the columns in my driver from:

Code:
    key <AD01> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN,            q,          Q ] };
    ...
    key <AB10> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN,        slash,   question ] };
to:

Code:
    key <AD01> { [            q,          Q, Cyrillic_softsign, Cyrillic_SOFTSIGN ] };
    ...
    key <AB10> { [        slash,   question, Cyrillic_hardsign, Cyrillic_HARDSIGN ] };
The bottom line is: with the yawerty keyboard layout it is possible to write either Russian or English while with my keyboard layout it is possible to write occasionally in English but in order to write some longer text I have to switch the keyboard layout using the keyboard shortcuts mentioned at the beginning.

***

I wrote a simple script displaying my keyboard layout:

ru
Code:
#!/bin/bash

cat<<EOF

 Q  W  E  R  T  Y  U  I  O  P  [  ]
 Ь  В  Э  Р  Т  Ы  У  И  О  П  Ш  Щ

  A  S  D  F  G  H  J  K  L  ;  '  
  А  С  Д  Ф  Г  Х  Й  К  Л  Ё  Ю  

   Z  X  C  V  B  N  M  ,  .  /    
   З  Ж  Ц  Ч  Б  Н  М  Я  Е  Ъ    

EOF
In order to run it when I use the Russian keyboard layout I made a symbolic link to it:

ln -s ru ру

***

To be continued...
 
1 members found this post helpful.
Old 12-30-2014, 03:05 AM   #4
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
My Russian keyboard layout for the console is the following:

ru-us.map
Code:
## Russian keyboard layout for the American keyboard
## designed by Cezary M. Kruk <c.kruk@bigfoot.com>

## console version

## put ru-us.map file into /usr/share/kbd/keymaps/i386/qwerty directory

## to set the Russian font use the command:
## setfont -v koi8u_8x16.psfu

## to load this keymap use the command:
## loadkeys ru-us.map

## for the punctuation marks or the Latin alphabet
## use the right Alt + key keyboard shortcuts

## Q  W  E  R  T  Y  U  I  O  P  [  ]
## Ь  В  Э  Р  Т  Ы  У  И  О  П  Ш  Щ
##
##  A  S  D  F  G  H  J  K  L  ;  '  
##  А  С  Д  Ф  Г  Х  Й  К  Л  Ё  Ю  
##
##   Z  X  C  V  B  N  M  ,  .  /    
##   З  Ж  Ц  Ч  Б  Н  М  Я  Е  Ъ    
##

alt_is_meta
                       keycode    1  =  Escape             Escape
                       keycode    2  =  one                exclam
                       keycode    3  =  two                at           at
                       keycode    4  =  three              numbersign
                       keycode    5  =  four               dollar       section
                       keycode    6  =  five               percent
                       keycode    7  =  six                asciicircum
                       keycode    8  =  seven              ampersand    braceleft
                       keycode    9  =  eight              asterisk     bracketleft
                       keycode   10  =  nine               parenleft    bracketright
                       keycode   11  =  zero               parenright   braceright
                       keycode   12  =  minus              underscore   backslash
                       keycode   13  =  equal              plus
                       keycode   14  =  Delete             Delete
                       keycode   15  =  Tab                Meta_Tab
                       keycode   16  =  U+044C             U+042C       # CYRILLIC SOFT SIGN
altgr                  keycode   16  =  q
altgr           shift  keycode   16  =  Q
                       keycode   17  =  U+0432             U+0412       # CYRILLIC VE
altgr                  keycode   17  =  w
altgr           shift  keycode   17  =  W
                       keycode   18  =  U+044D             U+042D       # CYRILLIC E
altgr                  keycode   18  =  e
altgr           shift  keycode   18  =  E
                       keycode   19  =  U+0440             U+0420       # CYRILLIC ER
altgr                  keycode   19  =  r
altgr           shift  keycode   19  =  R
                       keycode   20  =  U+0442             U+0422       # CYRILLIC TE
altgr                  keycode   20  =  t
altgr           shift  keycode   20  =  T
                       keycode   21  =  U+044B             U+042B       # CYRILLIC YERU
altgr                  keycode   21  =  y
altgr           shift  keycode   21  =  Y
                       keycode   22  =  U+0443             U+0423       # CYRILLIC U
altgr                  keycode   22  =  u
altgr           shift  keycode   22  =  U
                       keycode   23  =  U+0438             U+0418       # CYRILLIC I
altgr                  keycode   23  =  i
altgr           shift  keycode   23  =  I
                       keycode   24  =  U+043E             U+041E       # CYRILLIC O
altgr                  keycode   24  =  o
altgr           shift  keycode   24  =  O
                       keycode   25  =  U+043F             U+041F       # CYRILLIC PE
altgr                  keycode   25  =  p
altgr           shift  keycode   25  =  P
                       keycode   26  =  U+0448             U+0428       # CYRILLIC SHA
altgr                  keycode   26  =  bracketleft
altgr  shift           keycode   26  =  braceleft
       control         keycode   26  =  Escape
                       keycode   27  =  U+0449             U+0429       # CYRILLIC SHCHA
altgr                  keycode   27  =  bracketright
altgr  shift           keycode   27  =  braceright
                       keycode   28  =  Return
       control         keycode   28  =  Meta_Control_m
alt                    keycode   28  =  Meta_Control_m
                       keycode   29  =  Control
                       keycode   30  =  U+0430             U+0410       # CYRILLIC A
altgr                  keycode   30  =  a
altgr  shift           keycode   30  =  A
                       keycode   31  =  U+0441             U+0421       # CYRILLIC ES
altgr                  keycode   31  =  s
altgr  shift           keycode   31  =  S
                       keycode   32  =  U+0434             U+0414       # CYRILLIC DE
altgr                  keycode   32  =  d
altgr  shift           keycode   32  =  D
                       keycode   33  =  U+0444             U+0424       # CYRILLIC EF
altgr                  keycode   33  =  f
altgr  shift           keycode   33  =  F
                       keycode   34  =  U+0433             U+0413       # CYRILLIC GHE
altgr                  keycode   34  =  g
altgr  shift           keycode   34  =  G
                       keycode   35  =  U+0445             U+0425       # CYRILLIC HA
altgr                  keycode   35  =  h
altgr  shift           keycode   35  =  H
                       keycode   36  =  U+0439             U+0419       # CYRILLIC SHORT I
altgr                  keycode   36  =  j
altgr  shift           keycode   36  =  J
                       keycode   37  =  U+043A             U+041A       # CYRILLIC KA
altgr                  keycode   37  =  k
altgr  shift           keycode   37  =  K
                       keycode   38  =  U+043B             U+041B       # CYRILLIC EL
altgr                  keycode   38  =  l
altgr  shift           keycode   38  =  L
                       keycode   39  =  U+0451             U+0401       # CYRILLIC IO
altgr                  keycode   39  =  semicolon
altgr  shift           keycode   39  =  colon
                       keycode   40  =  U+044E             U+042E       # CYRILLIC YU
altgr                  keycode   40  =  apostrophe
altgr  shift           keycode   40  =  quotedbl
                       keycode   41  =  grave              asciitilde
                       keycode   42  =  Shift
                       keycode   43  =  backslash          bar
altgr                  keycode   43  =  backslash
altgr  shift           keycode   43  =  bar
                       keycode   44  =  U+0437             U+0417       # CYRILLIC ZE
altgr                  keycode   44  =  z
altgr  shift           keycode   44  =  Z
                       keycode   45  =  U+0436             U+0416       # CYRILLIC ZHE
altgr                  keycode   45  =  x
altgr  shift           keycode   45  =  X
                       keycode   46  =  U+0446             U+0426       # CYRILLIC TSE
altgr                  keycode   46  =  c
altgr  shift           keycode   46  =  C
                       keycode   47  =  U+0447             U+0427       # CYRILLIC CHE
altgr                  keycode   47  =  v
altgr  shift           keycode   47  =  V
                       keycode   48  =  U+0431             U+0411       # CYRILLIC BE
altgr                  keycode   48  =  b
altgr  shift           keycode   48  =  B
                       keycode   49  =  U+043D             U+041D       # CYRILLIC EN
altgr                  keycode   49  =  n
altgr  shift           keycode   49  =  N
                       keycode   50  =  U+043C             U+041C       # CYRILLIC EM
altgr                  keycode   50  =  m
altgr  shift           keycode   50  =  M
                       keycode   51  =  U+044F             U+042F       # CYRILLIC YA
altgr                  keycode   51  =  comma
altgr  shift           keycode   51  =  less
                       keycode   52  =  U+0435             U+0415       # CYRILLIC IE
altgr                  keycode   52  =  period
altgr  shift           keycode   52  =  greater
                       keycode   53  =  U+044A             U+042A       # CYRILLIC HARD SIGN
altgr                  keycode   53  =  slash
altgr  shift           keycode   53  =  question
                       keycode   54  =  Shift
                       keycode   55  =  KP_Multiply
                       keycode   56  =  Alt
                       keycode   57  =  space              space
                       keycode   58  =  Caps_Lock
                       keycode   59  =  F1                 F11          Console_13
alt                    keycode   59  =  Console_1
alt    control         keycode   59  =  Console_1
                       keycode   60  =  F2                 F12          Console_14
alt                    keycode   60  =  Console_2
alt    control         keycode   60  =  Console_2
                       keycode   61  =  F3                 F13          Console_15
alt                    keycode   61  =  Console_3
alt    control         keycode   61  =  Console_3
                       keycode   62  =  F4                 F14          Console_16
alt                    keycode   62  =  Console_4
alt    control         keycode   62  =  Console_4
                       keycode   63  =  F5                 F15          Console_17
alt                    keycode   63  =  Console_5
alt    control         keycode   63  =  Console_5
                       keycode   64  =  F6                 F16          Console_18
alt                    keycode   64  =  Console_6
alt    control         keycode   64  =  Console_6
                       keycode   65  =  F7                 F17          Console_19
alt                    keycode   65  =  Console_7
alt    control         keycode   65  =  Console_7
                       keycode   66  =  F8                 F18          Console_20
alt                    keycode   66  =  Console_8
alt    control         keycode   66  =  Console_8
                       keycode   67  =  F9                 F19          Console_21
alt                    keycode   67  =  Console_9
alt    control         keycode   67  =  Console_9
                       keycode   68  =  F10                F20          Console_22
alt                    keycode   68  =  Console_10
alt    control         keycode   68  =  Console_10
                       keycode   69  =  Num_Lock
                       keycode   70  =  Scroll_Lock        Show_Memory  Show_Registers
                       keycode   71  =  KP_7
alt                    keycode   71  =  Ascii_7
                       keycode   72  =  KP_8
alt                    keycode   72  =  Ascii_8
                       keycode   73  =  KP_9
alt                    keycode   73  =  Ascii_9
                       keycode   74  =  KP_Subtract
                       keycode   75  =  KP_4
alt                    keycode   75  =  Ascii_4
                       keycode   76  =  KP_5
alt                    keycode   76  =  Ascii_5
                       keycode   77  =  KP_6
alt                    keycode   77  =  Ascii_6
                       keycode   78  =  KP_Add
                       keycode   79  =  KP_1
alt                    keycode   79  =  Ascii_1
                       keycode   80  =  KP_2
alt                    keycode   80  =  Ascii_2
                       keycode   81  =  KP_3
alt                    keycode   81  =  Ascii_3
                       keycode   82  =  KP_0
alt                    keycode   82  =  Ascii_0
                       keycode   83  =  KP_Period
altgr  control         keycode   83  =  Boot
alt    control         keycode   83  =  Boot
                       keycode   84  =  Last_Console
                       keycode   85  = 
                       keycode   86  =  less               greater      bar
alt                    keycode   86  =  Meta_less
                       keycode   87  =  F11                F11          Console_23
       control         keycode   87  =  F11
alt                    keycode   87  =  Console_11
alt    control         keycode   87  =  Console_11
                       keycode   88  =  F12                F12          Console_24
       control         keycode   88  =  F12
alt                    keycode   88  =  Console_12
alt    control         keycode   88  =  Console_12
                       keycode   89  = 
                       keycode   90  = 
                       keycode   91  = 
                       keycode   92  = 
                       keycode   93  = 
                       keycode   94  = 
                       keycode   95  = 
                       keycode   96  =  KP_Enter
                       keycode   97  =  Control
                       keycode   98  =  KP_Divide
                       keycode   99  =  VoidSymbol
       control         keycode   99  =  Control_backslash
alt                    keycode   99  =  Control_backslash
                       keycode  100  =  AltGr
                       keycode  101  =  Break
                       keycode  102  =  Find
                       keycode  103  =  Up
                       keycode  104  =  Prior
                shift  keycode  104  =  Scroll_Backward
                       keycode  105  =  Left
alt                    keycode  105  =  Decr_Console
                       keycode  106  =  Right
alt                    keycode  106  =  Incr_Console
                       keycode  107  =  Select
                       keycode  108  =  Down
                       keycode  109  =  Next
                shift  keycode  109  =  Scroll_Forward
                       keycode  110  =  Insert
                       keycode  111  =  Remove
altgr  control         keycode  111  =  Boot
alt    control         keycode  111  =  Boot
                       keycode  112  = 
                       keycode  113  = 
                       keycode  114  = 
                       keycode  115  = 
                       keycode  116  = 
                       keycode  117  = 
                       keycode  118  = 
                       keycode  119  = 
                       keycode  120  = 
                       keycode  121  = 
                       keycode  122  = 
                       keycode  123  = 
                       keycode  124  = 
                       keycode  125  = 
                       keycode  126  = 
                       keycode  127  = 
# usual stuff for F1-F30
strings as usual
To use it put ru-us.map file into /usr/share/kbd/keymaps/i386/qwerty directory. Then use the following commands:

setfont -v koi8u_8x16.psfu
loadkeys ru-us.map

The first sets the font and the second loads the keyboard map.

In order to make switching the keyboard easier I wrote the following script:

kbd
Code:
#!/bin/sh

# to run this script use the sourced command
# this means the command preceded by the dot:
# . kbd

# if you are non root make sure that you have
# root privileges to setfont and loadkeys

if [ "$KBD" != "RU-US" ]
then
    # sets the Russian font and keymap
    sudo setfont -v koi8u_8x16.psfu
    sudo loadkeys ru-us.map
    KBD="RU-US"
else
    # sets the Polish font and keymap
    sudo setfont -v lat2-16.psfu
    sudo loadkeys pl2.map
    KBD=""
fi

export KBD
This scripts sets the KBD variable so you should source it during running:

. kbd

If you are not root you need the root privileges to setfont and loadkeys.

To write in English you may use the kbd script without any modifications – this means with the Polish font and keymap. To write in some other languages – such as German or French – you have to modify a bit ru-us.map keyboard layout and the kbd script.

***

The above keyboard layout for the console is the same as the previous keyboard layout for X Window and it works the same way.

If you prefer the keyboard layout with the Latin alphabet preceding the Russian one you have to modify the consecutive entries from:

Code:
                       keycode   51  =  U+044F             U+042F       # CYRILLIC YA
altgr                  keycode   51  =  comma
altgr  shift           keycode   51  =  less
to:

Code:
altgr                  keycode   51  =  U+044F             # CYRILLIC YA
altgr  shift           keycode   51  =  U+042F             # CYRILLIC YA
                       keycode   51  =  comma              less
***

In order to display the UTF-8 characters in the console mode you have to add to /etc/lilo.conf the line such as:

Code:
append=" vt.default_utf8=1"
then run lilo command, and finally reboot the system.

Last edited by w1k0; 12-30-2014 at 05:57 AM.
 
1 members found this post helpful.
Old 12-30-2014, 03:11 AM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,193
Blog Entries: 24

Rep: Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159
This was my last look at LQ before shutting down for night (after 2AM now).

I'll mark this as my start page for tomorrow and give it a try!

Thanks!
 
Old 12-30-2014, 08:40 AM   #6
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
For the completeness I prepared an extended version of the kbd script. Now it allows to switch the keyboard either in the console mode or in X Window. As for X Window I prefer to switch the keyboard layouts using the keyboard shortcuts but you may prefer to switch them from the command line.

kbd
Code:
#!/bin/sh

# to run this script use the sourced command
# this means the command preceded by the dot:
# . kbd

# in order to use this script in the console mode
# you need the root privileges to setfont and loadkeys

if [ "$DISPLAY" == "" ]
then
    echo -n "Console version: "
    if [ "$KBDC" != "RU-US" ]
    then
        # sets the Russian font and keymap
        echo "Russian keyboard."
        sudo setfont -v koi8u_8x16.psfu
        sudo loadkeys ru-us.map
        KBDC="RU-US"
    else
        # sets the Polish font and keymap
        echo "non-Russian keyboard."
        sudo setfont -v lat2-16.psfu
        sudo loadkeys pl2.map
        KBDC=""
    fi
else
    echo -n "X Window version: "
    if [ "$KBDX" != "RU-US" ]
    then
        # sets the Russian font and keymap
        echo "Russian keyboard."
        setxkbmap ru-us
        KBDX="RU-US"
    else
        # sets the Polish font and keymap
        echo "non-Russian keyboard."
        setxkbmap pl
        KBDX=""
    fi
fi

export KBDC KBDX
***

Я скачал четыре альбома Бориса Гребенщикова («Радио Африка», «Русский Альбом», «Аквариум 1995-2013» и «Соль») и сейчас я слушаю первого. В моей второй нити qweasd сравнил Гребенщикова с Высоцким. Я могу согласиться что он второй после Высоцкого, хотя я не знаю хорошо других Русских бардов.

***

Taking into consideration that in Poland it was after 10 AM when on your clock it was after 2 AM I may guess that you live somewhere between Guatemala and California (I mean the time zones).
 
Old 12-30-2014, 06:16 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,193
Blog Entries: 24

Rep: Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159
Thanks again!

Right distance but wrong direction on the time zone! West of the Rocky Mountains, US mainland.

I have tried your console keymap, and now added it to my system essentials archives. However, my fingers have learned to use the Yawerty variant that I have used for the past few months and are slow and clumsy to make changes, so I think I will continue with it for now.

The phonetic mapping of Э is better on yours, but then Е and Ё are non-phonetic. Ш and Щ are the same on yours and my current map, then there are differences with Ъ, Я, ь and maybe a few others.

Oddly enough, the only one I regularly stumble over is Ю, which is the same on yours and mine. I think it is because of odd placement on my laptop keyboard, bottom row between left-alt and space-bar.

snip --- My comments about Ж, Ц and Ч were not correct... ---


OT - Я наблюдал и слушать Бориса Гребенщикова только на YouTube. Соль - Бетка, некоторые другие, oчень хорошо!

Last edited by astrogeek; 12-30-2014 at 10:02 PM.
 
Old 12-30-2014, 07:03 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,193
Blog Entries: 24

Rep: Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159
Quote:
Originally Posted by w1k0 View Post

I wrote a simple script displaying my keyboard layout:

ru
Code:
#!/bin/bash

cat<<EOF

 Q  W  E  R  T  Y  U  I  O  P  [  ]
 Ь  В  Э  Р  Т  Ы  У  И  О  П  Ш  Щ

  A  S  D  F  G  H  J  K  L  ;  '  
  А  С  Д  Ф  Г  Х  Й  К  Л  Ё  Ю  

   Z  X  C  V  B  N  M  ,  .  /    
   З  Ж  Ц  Ч  Б  Н  М  Я  Е  Ъ    

EOF
In order to run it when I use the Russian keyboard layout I made a symbolic link to it:

ln -s ru ру
This was a great idea! Wish I had thought of it!

I keep a printed map taped to side of a computer on my desk, but I need something on other computers so I made a simple text file that I can cat or open in Vim.

But writing a script AND creating a symlink that works when using Russian keymap is much better! That is now working on all my machines!

My script is named russkeys - with nod to Dr. Strangelove!

Last edited by astrogeek; 12-31-2014 at 01:54 AM.
 
Old 12-31-2014, 11:53 AM   #9
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
I agree that Ю is the hardest character to memorize its place on my phonetic keyboard. I do not use my Russian keyboard too frequently. When I use it I usually have to check the position of Ю using my ru script.

As for laptop keyboards I accept only the standard ones. This means for me – the same as the keyboard of the desktop computer. So almost all my laptops are IBM/Lenovo ThinkPads with the American keyboards.

My friend gave me recently an old German Fujitsu-Siemens laptop. I installed on it Slackware and then I coded a few programs. It was a nightmare not because of a few German characters printed on some keys nor because swapped Z and Y. I know where Z, Y, ;, and ' characters are so I hit them even when they are described as Y, Z, Ö, and Ä. The real problems were caused by Home, End, PgUp, PgDn, etc. keys because all of them are in some wrong places on Fujitsu-Siemens. The same concerns the laptops made by Toshiba, Hewlett-Packard, and most other manufacturers.

***

Ит сээмс то мэ тхат ыоу ликэ пуззлэс со тхис сэнтэнцэ ис а пуззлэ нот фор ыоу бут фор тхэ пэоплэ усинг Гооглэ то транслатэ тхэ форэигн тэжтс.

As for the puzzles: some time ago I started to read “Ada” by Nabokov. I reached the chapter 35 in which young lovers exchange the encoded letters. They used a very simple code but I realized that it has some potential. At that very moment I stopped to read “Ada” and I started to improve this code.

After two weeks of work I prepared the script which encodes or decodes the texts using one-time pad. It is not possible to crack such a code using any method because each character of the text is coded using different key. As a result the word “astrogeek” used for a few times in the same message may be encoded as: “&мČ+ĆШčЮ@”, “eeeeeeeee”, or even “astrogeek” though this last possibility is very improbable (in fact it is the same improbable as any other possibility).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard layout plugin disappears after keyboard is plugged in XFCE4 fsb Linux - Laptop and Netbook 0 01-04-2013 05:45 PM
How to change the keyboard layout (I have English-Russian set-up, Russian kbd wrong) Wombat Pete Linux - Newbie 20 05-07-2010 11:08 AM
Selecting layout for secondary keyboard (Russian) lathuile Ubuntu 2 01-02-2007 11:24 AM
Russian Ukrainian Keyboard Layout Desperado2006 SUSE / openSUSE 2 09-04-2006 03:05 AM
Alt Keyboard Layout Setup esp Russian luegner Slackware 1 11-23-2003 01:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration