When plugging an external keyboard in on OS X, a wizard pops up to help select the keyboard layout. That layout is then somehow saved and reused automatically when you plug the external keyboard at a later point.
Additionally, if you use the keyboard viewer you can see the keyboard layout change in real time based on which keyboard's key was last pressed.
I am trying to find a way to achieve the same effect for the input source. Basically a way to register an input source with a specific keyboard and have the input source switch back and forth automatically when pressing a key from one keyboard or another.
I do pair programming often and would like to have my pair use her/his keyboard with the proper layout and mapping while I use the internal keyboard on my MacBook Pro.
I know I can add a "shortcut" to switch input source, but that adds an uncanny step when one of the pair wants to intervene in the code (not to mention that we usually also have to change the IDE keymap which makes it even slower and more awkward).
If you are unaware of a tool to do this, but have pointers to resources on how to build one, I would also be interested as I have a hard time finding documentation on OS X events.