Remote desktop Windows -> Linux. How to use Linux keyboard layout?

4

1

I log in to an unprivileged windows 10 machine, but do most of my work on a remote desktop connection to a virtual linux installation.

I use the standard Remote Desktop that comes with windows and on the Linux end I get a login screen from xrdp before I get my Centos 7 desktop. I can sudo to root in Centos.

I'd like to use colemak on the linux box, but the keyboard layout from my local windows machine takes precedence.

Adding colemak on Centos was easy using the system settings, but no matter which layout I pick in Linux, the layout from the hosting windows machine "wins".

Chosing US layout or any other layout is also ignored. So this questions is applicable too if you replaced any national layout with colemak.

I have seen the opposite question asked a number of times (make local layout win), but I can't find the answer to my problem. Many answers to the opposite problem revolves around adding a registry key to ignore the host layout. But that key does not exist on my windows machine (and I doubt if I can change the registry settings).

Lasse L

Posted 2020-01-13T08:24:11.137

Reputation: 93

1So from the Windows machine you use RDP to access a Linux install? If so, what Linux OS, Centos? You are using MS RDP client to connect to Linux of what flavor and version exactly? It sounds like once you land on the Linux OS, you want the keyboard to work as if you were at the Linux machine console, right? – Pimp Juice IT – 2020-01-22T21:20:32.657

You state local keyboard layout wins. Well here they suggest to check if you can change something (RDP-Session Options: in Local Resources you have the ability to set Keyboard). It is possible you need that layout (key/driver) installed on your local machine (Which rights do you have on your local machine?). BTW You can use other applications that should allow you to use what installed in the guest machine. If I remember well No Machine (server + client) allowed it. There is a free version.

– Hastur – 2020-01-23T10:25:31.537

Is the linux box using xrdp to allow the remote connection? – Sam Forbis – 2020-01-23T23:19:21.707

Please add to your post which keyboard layout is used locally and which one remotely, and also some examples of local keyboard keys/combinations that 'win' over the remote. – harrymc – 2020-01-24T07:15:53.627

My 2¢ would be to install a utility on the linux machine to remap the out-of-place keys to their proper locations. I use a utility called karabiner-elements on my Mac to remap keys on my windows keyboard, but it seems to be macOS-only. I'm sure there has to be a similar utility on linux. – Next-Door Tech – 2020-01-25T21:26:58.533

1The trouble is that Xrdp doesn't seem to support X windows keyboard mappings properly.. Under the same link there is a fix within Linux that needs some work in your case. Good luck. – Hastur – 2020-01-27T11:43:39.970

Thank you @Hastur - it actually looks like that is the only way forward. But what a nightmare! – Lasse L – 2020-01-27T15:31:17.270

Yes a (little) nightmare... but 1) there is a file you can download and modify inside and 2) it was for this reason that I suggested to try something like No Machine (or similar)... You understand the proposed one is a patch to patch the not proper mapping... Let me know if it works... – Hastur – 2020-01-27T18:05:56.163

Answers

1

The trouble is that Xrdp doesn't seem to support X windows keyboard mappings properly.

It is an old problem discussed from 2012 and still patched somehow in the same way in 2019 (read the comments of the previous link).

In your case, since remote desktop takes the precedence, it seems logic to install the proper layout (colemak) on the windows machine and switch to that to use it in the virtual environment too. Since you are not in the possibility to install any driver I see only a couple of solutions:

  1. If you can install some program for the current user, you may try to use another program to connect with your emulated environment, choosing one that allows you to select the host keyboard layout. I remember that No Machine worked well once...you can try it (there is a free version too).

  2. To remap the keyboard inside Linux. From the this link you can download a file (km-0809.ini) with some mapping already made, and modify it for your purposes.

    sudo chown xrdp.xrdp /etc/xrdp/km-0809.ini 
    sudo chmod 644 /etc/xrdp/km-0809.ini
    sudo service xrdp restart
    

Hastur

Posted 2020-01-13T08:24:11.137

Reputation: 15 043

1

I would install the Colemak keyboard layout on the Windows PC first then choose the Colemak layout when accessing the virtual linux installation:

https://colemak.com/Windows

There is also a portable version available: http://sourceforge.net/project/showfiles.php?group_id=213088&package_id=264387

Of course, given you are using an unprivileged windows machine, this may not work.

Natsu Kage

Posted 2020-01-13T08:24:11.137

Reputation: 781

Thank you for your answer. Unfortunately it is impossible to install anything - even portable versions. – Lasse L – 2020-01-27T08:23:53.027

1

The local keyboard is not a resource that Remote desktop can make available on the remote computer. The most it can do is allow the Windows key combinations to be transparently passed over or locally executed:

enter image description here

The physical keys are handled by the local operating system, which then passes them to Remote desktop. Any translation of the received key-codes to characters is done locally, and not remotely.

Therefore the options as I see them are limited:

  • Install the same keyboard layout on both local and remote computers
  • Use a key-mapper product on the local computer for the problematic keys
  • Use a key-mapper product on the remote computer for the problematic keys

harrymc

Posted 2020-01-13T08:24:11.137

Reputation: 306 093