How do I add another language input method to Niri?

I’ve been studying Chinese for years and I wanted to be able to type in both Chinese and English on my computer with a toggle to switch between the two keyboards, but I’m not sure how. Help?

To do that you would need to tweak a bit your .config/niri/config.kdl and add a toggle to switch the kb layouts:

input {
    keyboard {
        xkb {
            // This loads English and Chinese layouts
            layout "us,cn"
            // This sets your toggle key combination (e.g., Super + Space)
            options "grp:win_space_toggle"
        }
    }
}

Also to turn your typing into actual Chinese characters you need a IME daemon like Fcitx5.
For this you have to edit again the config.kdl and add the fcitx5 daemon to autostart when you launch Niri.

spawn-at-startup "fcitx5" "-d"

Of course you have to install the fcitx5 package.

Also because niri is a tiling window manager it will most likely popup a giant terminal window. To stop this from happening you need to add a window rule in Niri.

window-rule {
    match app-id="fcitx" title="^Fcitx5 Input Window$"
    open-floating true
}