Layout groups

xkb-group.sh can help you to manage layout groups. Just run it and send some
input at it's stdin every time you want to trigger layouts from primary to
secondary and back. For example:

$ xkb-group.sh us ru
switch # switch from us to ru or from current layout to us
switch # switch from ru to us or from us to ru
(from other terminal)
$ xkb-switch -s de # switch to 'de' layout, change secondary layout to 'de'
(back to terminal running xkb-group.sh)
switch # switch from de to us
switch # switch from us to de

Bugs or Problems

Admittedly, I only tested with a few different layouts that I used. If you find
any bugs let me know at Github or ierton@gmail.com.

Xkb-switch contains some testing facilities, please include output of
`xkb-switch -x' command in the report.