This tutorial will explain how to setup Multiple simultaneous keyboards with unique layouts
Procedure to follow
1.) Determine which layout will be assigned to each keyboard.
2.) [Optional] create a new keyboard layout if you're after a custom one .
3.) Use the setxkbmap command with the -device tag to apply your keyboard maps to the relevant devices. If you don't know your device, start with 1 and work your way up. Be prepared to undo your change by repeating it with your current layout. For example, typing
setxkbmap -device 3 af
sets both of my keyboards to Farsi, and typing
setxkbmap -device 3 us
sets them both back to US. It's probably best to have this line copied and ready to paste before every change to easily undo your changes.
If you altered the Andorra keyboard layout with your own custom one run the following command from your terminal
setxkbmap -device 7 ad
Now Each keyboard is operating simultaneously with a unique layout.
Via Ubuntu forum