GNOME Bugzilla – Bug 676017
Boxes uses first xkb layout, not the currently active one
Last modified: 2016-03-31 13:58:00 UTC
Boxes reads the org/gnome/libgnomekbd/keyboard/layouts dconf key to get the list of X layouts currently used, and then picks the first item in that list. This list isn't updated to put the current layout first when the user switches to another layout, so what boxes does is not 100% accurate. It seems we'd need to use libxklavier to accurately get the currently active layout ( http://xlibs.freedesktop.org/xkbdesc/doc/libxklavier-xkl-engine.html )
libxklavier seems to set a XKLAVIER_STATE(INTEGER) X property (checked with xprop) whose first number is the index of the current X layout (which probably can be used as an index in the array stored in this gsettings key)
This should be fixed by: http://git.gnome.org/browse/gnome-boxes/commit/?id=4fc27d53a4197613b87083dc42861120bea6b11b