I would like to share with you my latest discovery: multi-layout keyboards on Unix-like systems.
First step is to add/edit the following file: /usr/local/etc/X11/xorg.conf.d/kbd-layout-multi.conf and add your wanted layouts. In this howto I will add 4 layouts: us, ro, fr, de (american-english, romanian, french and german):
Let's explain a little what's in this file:
i) XkbLayout - obviously it's for the languages we wish;
ii) XkbVariant - it's for keyboards variants, on my machine I wanted standard keyboard for romanian and no dead keys for french & german(",std,oss_nodeadkeys,").
iii) XkbOptions - here I've mapped the Pause key (compose: paus) so I can combine multiple keys to obtain difficult chars (eg. Pause +c+,=ç,).
_ lv3:ralt_switch (AltGr) - it's also for accessing different chars (eg. ø, µ, ł, ĸ, ŋ, đ, ð, ſ, æ, etc.).
_ grp:ctrl_shift_toggle_bidir - Ctrl+Shift which are dead keys in i3WM are used so I can switch between layouts in both direction (Left Ctrl+Shift is backward & Right Ctrl+Shift is forward)
Second step it's to use a keyboard layout indicator and switcher. Even if it wasn't my first choice x11/xkb-switch it's a good tool to do this. Since I'm using a WM (i3 and i3blocks as status), all I have to do it's to create a simple script which display the layouts.
The result:




First step is to add/edit the following file: /usr/local/etc/X11/xorg.conf.d/kbd-layout-multi.conf and add your wanted layouts. In this howto I will add 4 layouts: us, ro, fr, de (american-english, romanian, french and german):
Code:
Section "InputClass"
Identifier "All Keyboards"
MatchIsKeyboard "yes"
Option "XkbLayout" "us,ro,fr,de"
Option "XkbVariant" ",std,oss_nodeadkeys,"
Option "XkbOptions" "compose:paus,lv3:ralt_switch,grp:ctrl_shift_toggle_bidir"
EndSection
Let's explain a little what's in this file:
i) XkbLayout - obviously it's for the languages we wish;
ii) XkbVariant - it's for keyboards variants, on my machine I wanted standard keyboard for romanian and no dead keys for french & german(",std,oss_nodeadkeys,").
iii) XkbOptions - here I've mapped the Pause key (compose: paus) so I can combine multiple keys to obtain difficult chars (eg. Pause +c+,=ç,).
_ lv3:ralt_switch (AltGr) - it's also for accessing different chars (eg. ø, µ, ł, ĸ, ŋ, đ, ð, ſ, æ, etc.).
_ grp:ctrl_shift_toggle_bidir - Ctrl+Shift which are dead keys in i3WM are used so I can switch between layouts in both direction (Left Ctrl+Shift is backward & Right Ctrl+Shift is forward)
Second step it's to use a keyboard layout indicator and switcher. Even if it wasn't my first choice x11/xkb-switch it's a good tool to do this. Since I'm using a WM (i3 and i3blocks as status), all I have to do it's to create a simple script which display the layouts.
Code:
#!/bin/sh
layout=$(xkb-switch -p | cut -c 1-2)
case $layout in
us) echo "US"
;;
ro) echo "RO"
;;
fr) echo "FR"
;;
de) echo "DE"
;;
esac
The result:



