The swaykbdd utility can be used to automatically change the keyboard layout on a per-window or per-tab basis.
Just run swaykbdd
. For automatic start, add to the Sway config file the
following command:
exec swaykbdd
meson build
ninja -C build
sudo ninja -C build install
Arch users can install the program via AUR.