The shortcut to change was definitely something with Ctrl and Shift because I remember accidently switching layout when I was selecting text by whole words with Ctrl+Shift+Left/Right.
Tilde works funny on linux - it makes alternative version of every letter, not only from the current locale. I was accused of being a Russian pretending to be Polish on some Polish forum long ago because I wrote something with a Greek (or cyrylic?) letter by accident because I did something with home directory in the background and only pressed ~ once instead of twice :)