When I set up xrdp
on Raspbian Jessie a while ago, the keyboard layout appeared to be wrong - commonly used keys seemed to be returning US keycodes rather than UK ones. I found this post very helpful in resolving the problem, but it didn't quite fit the bill when I tried to do the same with a Raspbian Stretch instance recently. Here's what I did on Raspbian Stretch to set up xrdp
to provide the correct keycodes.
First, I checked the keboard layout was as expected:
$ cat /etc/default/keyboard | grep LAYOUT
XKBLAYOUT="gb"
Then, I generated a keyboard mapping file using xrdp-genkeymap
:
$ xrdp-genkeymap km-00000809.ini
This filename follows the current filename convention (under Jessie, it was km-0809.ini
). I then copied this file into the xrdp
configuration files directory:
$ sudo cp km-00000809.ini /etc/xrdp
The next step was to edit the file /etc/xrdp/xrdp_keyboard.ini
, which appears to be new in Raspbian Stretch. Here are the lines I added, in an excerpt from the file:
[default_rdp_layouts]
rdp_layout_us=0x00000409
rdp_layout_de=0x00000407
< ... lines omitted ... >
rdp_layout_br=0x00000416
rdp_layout_pl=0x00000415
rdp_layout_gb=0x00000809
; <rdp layout name> = <X11 keyboard layout value>
[default_layouts_map]
rdp_layout_us=us
rdp_layout_de=de
< ... lines omitted ... >
rdp_layout_br=br(abnt2)
rdp_layout_pl=pl
rdp_layout_gb=gb
In each case, I added the rdp_layout_gb=
lines. The final step was to restart the xrdp
service:
$ sudo service xrdp restart
On reconnecting, I found that the keycodes were as they should have been, and I had access to the £@'~#\|
keys again in their expected places on the keyboard.