1. It is unrelated to keyboard layout switching. Any global keyboard shortcuts handled by media-keys plugin of gnome-settings-daemon, such as volume up, volume down, etc., cause focus to switch.
2. As far as I know, vanilla gnome-settings-daemon does not handle switching of keyboard layout, see diff in previous comment. Ubuntu's fork called unity-settings-daemon uses media-keys plugin to switch keyboard and it has code changes to do that.
3. media-keys plugin is not designed to switch keyboard layout, there's a sort of hack in Ubuntu to utilize it for such purpose.
4. Losing focus when pressing volume up/volume down is a minor annoyance. Losing focus when switching keyboard layout is very major annoyance. But AFAIK vanilla gnome does not use 'media-keys' to switch layouts, it uses builtin xkbmap functionality.
Someone who has access to vanilla Gnome, can try following:
- Bind a key or key combination to volume up/down and something like that
- Put text caret into input box with visible focus. Good examples are: gnome terminal (cursor will blink), twitter in Firefox (reply box will roll up when losing focus)
- Press this key multiple times and see focus loses and moves back
Some clarification:
1. It is unrelated to keyboard layout switching. Any global keyboard shortcuts handled by media-keys plugin of gnome-settings- daemon, such as volume up, volume down, etc., cause focus to switch.
2. As far as I know, vanilla gnome-settings- daemon does not handle switching of keyboard layout, see diff in previous comment. Ubuntu's fork called unity-settings- daemon uses media-keys plugin to switch keyboard and it has code changes to do that.
3. media-keys plugin is not designed to switch keyboard layout, there's a sort of hack in Ubuntu to utilize it for such purpose.
4. Losing focus when pressing volume up/volume down is a minor annoyance. Losing focus when switching keyboard layout is very major annoyance. But AFAIK vanilla gnome does not use 'media-keys' to switch layouts, it uses builtin xkbmap functionality.
Someone who has access to vanilla Gnome, can try following:
- Bind a key or key combination to volume up/down and something like that
- Put text caret into input box with visible focus. Good examples are: gnome terminal (cursor will blink), twitter in Firefox (reply box will roll up when losing focus)
- Press this key multiple times and see focus loses and moves back