This app records keyboard layout for a i3 windows when you leave them. And when you come back it is restore keyboard layout.
$ pip install i3-xkb-switcher
Also you can download compiled binary from release page.
$ i3-xkb-switcher
To enable debug mode run with --debug
key.
By default it writes logs to stdout. You can specify path by --log-path
option.