0

I'm trying to get xrdp's keymaps to work properly on Ubuntu 16.04 using xfce on AMD64. I am using this as a development environment and I just want to be able to use phpstorm but tabs, arrows etc are just not working.

After much searching and many failed attempts, I ended up here: http://cloclotron.net/xrdp_keyboard_layout_workaround.html

I have no problem following the instructions, but the keys that do not work appear to be set correctly.

for instance, in my console keymap, the tab key line looks like this: 23 0xff09 (Tab) 0xfe20 (ISO_Left_Tab) 0xff09 (Tab) 0xfe20 (ISO_Left_Tab) which says to me that the code should be either (dec) 65056 or 65289, but line 23 of km-0409 is already showing 65289, when i set it to 65056 it makes no difference and the tab key still does not work.

I'm having the same issue with my arrow keys, and I've verified that they also appear to be correct.

How can I verify which keyboard layout is actually being used by xrdp?

Where is this setting stored?

Is there a better way to get a working keyboard layout?

tightvnc also has the wrong keymap.

When I connect via Virtual Machine Manager, the keyboard is correct

catbadger
  • 124

1 Answers1

1

It's late, but I try to answer your questions anyway, for future reference.

How can I verify which keyboard layout is actually being used by xrdp?

setxkbmap -query

Where is this setting stored?

You can find keuborad settings in /etc/xrdp/xrdp_keyboard.ini: the file contains a mapping between languages and keyboard layouts hex number.

Is there a better way to get a working keyboard layout?

The easiest way in most cases is to use a workaround (please, note that you must performed these steps while you are directly logged in into the machine, not through the remote desktop connection):

  1. Identify the hexadecimal number which corresponds to the desired layout by looking in the abov-mentioned file (xrdp_keyboard.ini).

  2. Backup the default layout (US) used by xrdp:

    sudo cp /etc/xrdp/km-00000409.ini /etc/xrdp/km-00000409.ini.bak

  3. Generate the current layout keymap file assigning to it the name of the default one:

    sudo xrdp-genkeymap /etc/xrdp/km-00000409.ini

  4. Restart xrdp and try to log into the machine via remote desktop connection

    sudo systemctl restart xrdp

Keep in mind that older versions of xrdp name the keymap files in a shorter way: km-0409.ini instead of km-00000409.ini.

To know what is going on, inspect xrdp logs:

tail -f /var/log/xrdp.log

UPDATE: nevertheless, you might experience again the same problem when reconecting a second time to the same host: it's a known issue. I don't know how to resolve it, but please, consider also the language settings on the Control Panel of the Windows client (or whatever is your client). Someone in the aforementioned issued suggested to modify the source code to mitigate the problem experienced when reconnecting:

  1. modify function rdpLoadLayout (change default options of layout and comment code when it mast be reapply with client info options):

static int rdpLoadLayout(rdpKeyboard *keyboard, struct xrdp_client_info *client_info) { XkbRMLVOSet set;

    int keylayout = client_info->keylayout;
LLOGLN(0, ("rdpLoadLayout: keylayout 0x%8.8x variant %s display %s", keylayout, client_info->variant, display));
memset(&set, 0, sizeof(set));
set.rules = "base";

set.model = "pc105";
set.layout = "us,ru";
set.variant = "";
set.options = "grp:ctrl_shift_toggle";

reload_xkb(keyboard->device, &set);
reload_xkb(inputInfo.keyboard, &set);
return 0;

}

  1. modify function rdpkeybControl
 set.model = "pc105";
 set.layout = "us,ru";
 set.variant = "";
 set.options = "grp:ctrl_shift_toggle";