Keyboard layout issues using Ubuntu 12.04 in ssh via X11 for mac

6,809

Solution 1

I eventually fixed my problem, what I did exactly is:

  1. in X11 preferences, I checked the "Follow system keyboard layout" and "Enable key equivalent under X11" items ;
  2. quit X11. Once X11 reopened, the keyboard layout was properly handled.

Solution 2

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:

export LC_COLLATE=en_US.UTF-8
export LC_ALL=ru_RU.UTF-8

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)

setxkbmap -rules evdev -model pc104 -layout us,ru

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!

Share:
6,809

Related videos on Youtube

LostInTranslation
Author by

LostInTranslation

Updated on September 18, 2022

Comments

  • LostInTranslation
    LostInTranslation over 1 year

    I just upgraded from 10.04 LTS to 12.04 LTS on my server (DELL Intel XEON). By SSH login from my mac (OS X Lion) everything is fine (no issues with command lines) but when I open a window through X11, the keyboard layout is now completely messed up. As an owner of a french mac keyboard, I got used to such issues and could deal by guessing the "QUERTY" keys, but this time it's worse.

    To fix it, I tried:

    1/

    sudo dpkg-reconfigure keyboard-configuration
    

    => no effect

    2/

    sudo gnome-control-center
    

    then change the keyboard settings, however adding a couple of keyboard layouts did not change anything.

    I feel there is something to do with the X11 forwarding. Any hints?

    Thanks

    • LostInTranslation
      LostInTranslation over 11 years
      I eventually fixed my problem, what I did exactly is: 1/ check the "Follow system keyboard layout" and "Enable key equivalent under X11" items in X11 preferences 2/ quit X11. Once launching a new window through X11, the keyboard layout was properly handled.
    • Mateo
      Mateo over 11 years
      can you add that as an answer?
    • LostInTranslation
      LostInTranslation over 11 years
      Sure, if that's the way to do.
  • Luís de Sousa
    Luís de Sousa over 9 years
    Your English is pretty decent, would go without editing, but you should not use slang.
  • Luís de Sousa
    Luís de Sousa over 9 years
    Detailed and understandable answers is what AskUbuntu needs. Keep them coming.
  • DioXine
    DioXine over 9 years
    thanx, for correcting me in that CODE places, but i hope it is not bad if i was exampling another os than ubuntu? :-)
  • Luís de Sousa
    Luís de Sousa over 9 years
    Regarding the scope of the question I think it is fine.
  • Petr Mánek
    Petr Mánek over 7 years
    didn't work for me