You can switch the alt and super keys using the keyboard configuration panel. I use xmodmap to switch the left keys and do a few more things. This setup appears to be more reliable over successive system updates. Here is my annotated .xmodmap:
! xmodmap for macbook keyboard.
! Vertical and horizontal mouse/touchpad scrolls like a touch screen.
! Note that 5 4 and 7 6 are reversed.
pointer = 1 2 3 5 4 7 6 8 9 10 11 12
! Switch left command and option (super and alt).
clear mod1
clear mod4
keycode 133 = Alt_L
keycode 64 = Super_L
add Mod1 = Alt_L
add mod4 = Super_L
! Right command and option are common keys that can be remapped
! using keyboard short cuts.
keycode 134 = Menu Break
keycode 108 = Pause Clear
! Map expose and dashboard to keys that can be remapped
! using keyboard short cuts.
keycode 128 = F15
keycode 212 = F16
I may not have a lot of experience with coding, software engineering or even with linux systems, but i do know one thing: a computer, no matter what system it uses, is mostly based on the human brain.
Now i know it's possible for a brain (and a computer) to learn 2 languages side-by-side, but what you're asking of the pc is a bit different. You're not asking it to use two languages side-by-side, you're asking it to use those two languages simultaniously, so basically to consider 2 outputs for a single input, and let the computer choose which one to use.
On itself, this shouldn't be too much of an issue, if it weren't for the fact that this translation process takes place within the software, rather than in the keyboard, making it (near) impossible for the computer to know which one to use. For instance (not entirely sure about the specific layout of the fr-iso keyboard, so forgive me if this is exaggerated) you could type the 'Q' key on the USB-keyboard, but the computer would have to interpret it as "'Q' or 'A'". Now yóu know you typed a Q, but all the computer knows is that you typed in a specific key with multiple translations. Which is where the keyboard settings come into action.
Using the keyboard layout setting, you tell your computer how to interpret your keystrokes. So you basically tell it what dictionary to use for that keyboard. If you want to use the other keyboard, you should set the dictionary to the appropriate language, or the computer might misinterpret your keystrokes, causing it to think you're still using the standard (fr-iso) keyboard, where you àctually want it to use the en-us dictionary. I would compare it with speaking spanish while in portugal: they mostly know what you mean, but some things just don't make sense due to semantic differences.
So, long story short: simultanious use is impossible, unless both keyboards have the ability to automatically tell the computer which layout to use. Imo, your best bet would be to set up shortcuts or scripts to easily change the keyboard settings (like Windows uses the Left-ctrl + Left-shift combination). However, to make sure this happens correctly, it ís recommended to manually map your keys (the only one who knows the correct interpretation for sure is you), and maybe find a way to export this mapping for easy use within either a script or application for ease of changing the layouts. (Like i said, no experience in coding, so although i assume there's a way, i'm not the person to know that way: comments would be welcome)
Hope it helps
Best Answer
In my case, running Yosemite and the latest version of xquartz, going through
ssh -X
to CentOS 6.5 in VMWare Fusion, I could not resolve that problem with switching layouts. US and Russian layouts, in my case. When I started, for example,gnome-terminal
, I just couldn't switch to my RU language, using any key combinations. So, after half a day of experimenting (I am not really a Linux geek, just kinda "half-of-a-power" user), I found a solution.Your mac
~/.profile
should look like this:If you use another language, change
LC_ALL=
for your language in your MacOs.Then you need to add the following line at the end of your
~/.bash_profile
on your ssh-connected machine (in my case - CentOS 6.5)This goes correctly, especially for the Russian language. But I am sure your OS must have another collection of layouts. And, at the end - ensure, than you enabled "Follow system keyboard layout" in X11->Preferences->Input tab.
After these manipulations, forwarded through ssh-X11, the GUI of your application will be able to switch layouts, using your usual MacOS shortcut. In my case, Command+Space. Don't forget to restart X11.
Maybe this will help someone ;-)
P.S.: in this example, I worked only with the Russian layout and keymap, so, again, change parameters for your own!