Knowledge Base
Searching in : Trouble report
ID:TR01V11077
Added on: 2024-01-31
Last Update: 2025-08-26
Affects: 8.10
Due to be solved in: 8.x
Platform: All Linux Platforms
Product: NoMachine Client
Severity: Minor
Status: Open
Print this article

Keyboard layout in the virtual desktop doesn't correspond to the local layout of the Linux client

This problem occurs when the client is running on Linux with Wayland enabled. The player is not a native application for Wayland and it relies on Xwayland for detecting the keyboard layout. An issue in Xwayland: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1546  makes it replying always that the keyboard is US and layout is therefore set to qwerty, regardless of which keyboard layout is really set on local.

For example let's say that the user has keyboard layout azerty with local configuration FR-variante. The remote configuration has FR instead. When the user creates the new session, the remote keyboard layout is qwerty instead of being azerty.

A possible workaround is to switch the remote keyboard layout from US (qwerty) to FR or FR-variante (azerty). To do that from a terminal inside the NoMachine session, run the 'setxkbmap -layout' command, for example:
setxkbmap -layout fr

 

Otherwise, set the preferred keyboard layout in a NoMachine custom script to be executed after session startup.

1) Create the setKeyboard.sh script. The script must be executable.

2) Place the script in a directory that is accessible by the node, i.e. accessible by the connecting user since the node runs as such user. For example /usr/NX/scripts/custom/.

3) The script should provide the command to set the keyboard layout, 'exit 0' is needed to start the session even if the script fails for some reasons:

#!/bin/sh
export HOME=/home/$2
export DISPLAY=:$4
/usr/bin/setxkbmap -layout fr
exit 0

4) In the node configuration file  /usr/NX/etc/node.cfg set the following key:

UserScriptAfterSessionStart = "/usr/NX/scripts/custom/setKeyboard.sh"

(remove the pre-pending # from the key name).