I'm using Xubuntu 18.04. I wasn't quite satisfied with how it handles keyboard layouts (because you can't add more than four layouts, or at least I couldn't find how to do it), so I've just defined some keyboard shortcuts for commands like
setxkbmap -layout ua. It works.
A problem appears when I switch with
setxkbmap to a non-Latin layout: keyboard shortcuts like Ctrl-x or Ctrl-v work in some applications (Skype, Chrome, VS Code...) but not in others (mousepad, GNOME Terminal, Gummi...). If I use the default xfce4 mechanisms to switch between layouts, keyboard shortcuts work correctly everywhere (except Emacs, but it has its own ways to fix it, so it's less annoying).
Knowing that it somehow is possible, I tried to reimplement the behaviour myself with
xbindkeys by mapping things like Ctrl-м to Ctrl-v. However, applications seem to just ignore my attempts to send them fake key presses, whether I do it with
xvkbd -text "\Cv",
xvkbd -xsendevent -text "\Cv" or
xdotool key $(xdotool getwindowfocus) "Control_L+v". Why is it like that and what can I do now?