If you add the following line to your i3 configuration it should work just like in Unity
exec --no-startup-id "setxkbmap -model pc105 -layout us,gr -option grp:alt_shift_toggle"
If you use some variant of the these layouts you can also add the
-variant option. For example,
-variant euro,simple will use the
euro variant of the
us layout and the
simple variant for the
gr layout (same order as
-layout). In order to use the default variant just leave it out, so
-variant euro, will use
us, but the default for
Also the above line assumes that a default 105-key PC-keyboard will be used. If you use anything else change the model accordingly.
setxkbmap -query you can see what is currently set. If you run it before adding the above line to the configuration, you can see what is set by Xorg.
There is also the chance that Unity is using the same method to set multiple layouts (I do not use Unity, so I cannot check). So if you log in with Unity and just run
setxkbmap -query you might get everything you need to set layout changing for i3 the exact same way.
For example, the output
would translate to the above
Have a look on this Arch Linux Documentation for more information. The 'Setting keyboard layout' section works just as well with Ubuntu.