I'm surprised that I didn't find a solution for that online. Or in configs, actually.
The setup is that I have a different language on every window, and I have a window (terminal) set to be on top. Now, I want to switch a language in one of the windows that is not on top. If I'm doing this with the mouse, then there is no problem. Using a keyboard shortcut, on the other hand, results with the language being changed on the window that is set on top. I can undo that by setting the window that is on top to not still focus, but I don't always want that.
So is there a way to solve this?