Tiny Core Base > TCB Q&A Forum

Switching keyboard layouts in Xfbdev?

<< < (2/2)

jazzbiker:
Hi, all!

This topic presents the correct method of solving the problem, but without details, so I want to share my results, they may be used directly by newcomers and advanced by the experienced Core users.
I use ru_RU.UTF-8 locale and will use it as an example.

Traditional TC localization steps:

--- Code: ---tce-load -w getlocale.tcz
tce-load -i getlocale.tcz
getlocale.sh
# script will ask You for locales to load and will create Your personalized mylocale.tcz extension

echo "mylocale.tcz" >> "$(readlink /etc/sysconfig/tcedir)"/onboot.lst

# then add the exact name of locale chosen to Your bootcodes : lang=ru_RU.UTF-8

tce-load -w setfont.tcz
tce-load -i setfont.tcz

#choose appropriate font in /usr/local/share/consolefonts directory
#in my case it is UniCyr_8x16.psf.gz
#and load this font during boot

echo "setfont.tcz" >> "$(readlink /etc/sysconfig/tcedir)"/onboot.lst
echo "setfont UniCyr_8x16" >> /opt/bootlocal.sh

#next is console keyboard mapping

tce-load -w kmaps.tcz
tce-load -i kmaps.tcz
echo "kmaps.tcz" >> "$(readlink /etc/sysconfig/tcedir)"/onboot.lst

#choose desired keymapping in /usr/local/share/kmap
#for me it is qwerty/ ruwin_ct_sh-UTF-8.kmap
#and add appropriate bootcode to Your bootloader config : kmap= ruwin_ct_sh-UTF-8

--- End code ---

All this was around console localization and it is desirable for flawless Xfbdev localization, though console kmaps probably may be omitted, You can try if You want.

Now start Xfbdev, create layouts directory, f.e.

--- Code: ---cd
mkdir layouts

--- End code ---
and capture the default X keymapping:

--- Code: ---xmodmap -pke > ~/layouts/default.xkmap

--- End code ---
then create alternative ( in the example russian ) layout:

--- Code: ---cat << EOF > ~/layouts/russian.xkmap
keycode  24 = Cyrillic_shorti Cyrillic_SHORTI
keycode  25 = Cyrillic_tse Cyrillic_TSE
keycode  26 = Cyrillic_u Cyrillic_U
keycode  27 = Cyrillic_ka Cyrillic_KA
keycode  28 = Cyrillic_ie Cyrillic_IE
keycode  29 = Cyrillic_en Cyrillic_EN
keycode  30 = Cyrillic_ghe Cyrillic_GHE
keycode  31 = Cyrillic_sha Cyrillic_SHA
keycode  32 = Cyrillic_shcha Cyrillic_SHCHA
keycode  33 = Cyrillic_ze Cyrillic_ZE
keycode  34 = Cyrillic_ha Cyrillic_HA
keycode  35 = Cyrillic_hardsign Cyrillic_HARDSIGN
keycode  38 = Cyrillic_ef Cyrillic_EF
keycode  39 = Cyrillic_yeru Cyrillic_YERU
keycode  40 = Cyrillic_ve Cyrillic_VE
keycode  41 = Cyrillic_a Cyrillic_A
keycode  42 = Cyrillic_pe Cyrillic_PE
keycode  43 = Cyrillic_er Cyrillic_ER
keycode  44 = Cyrillic_o Cyrillic_O
keycode  45 = Cyrillic_el Cyrillic_EL
keycode  46 = Cyrillic_de Cyrillic_DE
keycode  47 = Cyrillic_zhe Cyrillic_ZHE
keycode  48 = Cyrillic_e Cyrillic_E
keycode  49 = Cyrillic_io Cyrillic_IO
keycode  52 = Cyrillic_ya Cyrillic_YA
keycode  53 = Cyrillic_che Cyrillic_CHE
keycode  54 = Cyrillic_es Cyrillic_ES
keycode  55 = Cyrillic_em Cyrillic_EM
keycode  56 = Cyrillic_i Cyrillic_I
keycode  57 = Cyrillic_te Cyrillic_TE
keycode  58 = Cyrillic_softsign Cyrillic_SOFTSIGN
keycode  59 = Cyrillic_be Cyrillic_BE
keycode  60 = Cyrillic_yu Cyrillic_YU
EOF

--- End code ---

and now You can change layouts using:

--- Code: ---cat ~/layouts/russian.xkmap | xmodmap -
cat ~/layouts/default.xkmap | xmodmap -

--- End code ---

Don't forget to use UTF-compatible terminal (for example rxvt.tcz) and load UTF-8  fonts.

The trap on Your shiny way is, that when You have changed the layout to the local one, You loose the possibility to enter commands 8-0 . This trouble may be overcomed by using the small script in the separate terminal window, which will do all the work, controlled by Enter key pressed

--- Code: ---while true
do
  cat ~/layouts/default.xkmap | xmodmap -
  echo "default"; read
  cat ~/layouts/russian.xkmap | xmodmap -
  echo "russian"; read
done

--- End code ---

This is the simplest way, not requiring any additional software. Maybe You will want to use xbindkeys.tcz to perform the better solution.

In order to create Your own layout for Your locale You will need xorg-proto.tcz inatalled and /usr/local/include/X11/keysymdef.h  file, which defines symbol names (excluding XK_ prefix).
That's all, folks. Don't forget to share Your keymappings.

Have a nice Xfbdev!

Navigation

[0] Message Index

[*] Previous page

Go to full version