How can I sort out Xephyr's keyboard mapping?

Solution 1:

I found Bug 19365 which solved my problem:

Starting Xnest / Xephyr with -kb.

Solution 2:

The -kb option doesn't work in Ubuntu 10.04. Here's what worked for me:

Xephyr -keybd ephyr,,,xkbmodel=evdev -ac -screen 800x600 -br -reset -terminate :1

Solution 3:

After more unsuccessful googling, man setxkbmap finally pointed me into an easier solution:

USING WITH xkbcomp

If you have an Xserver and a client shell running on different computers and XKB configuration files on those machines are different you can get problems specifying a keyboard map by model, layout, options names.[...] You can solve this problem by running the xkbcomp on the client side too.[..] For example, the command

setxkbmap us -print | xkbcomp - $DISPLAY

makes both steps run on the same (client) machine and loads a keyboard map into the server.

That is,

  • launch Xephyr:

    Xephyr -ac -reset -screen 800x600 -retro :50 &
    

    (no need to provide keyboard info)

  • and configure the new xsession:

    setxkbmap de -print | xkbcomp - :50
    

    (you need to know your keyboard layout)

Note: setxkbmap is your friend, and from version 1.2.0 the useful -query option is available to help you troubleshooting your keyboard (see the corresponding patch log).

Solution 4:

You can also run xkbcomp $DISPLAY :1 in X session in which Xephyr was started. This command will copy keyboard map from current server to your newly created. I use it like this:

Xephyr -screen 800x600 :1 > /dev/null &
sleep 2 && xkbcomp $DISPLAY :1
DISPLAY=":1" ./runcommand

Solution 5:

setxkbmap -model evdev -print | xkbcomp :100 :200    

If you use Xephyr with xpra and you have incorrect keyboard map. If you see strange situation: Down key worked as enter (down arrow as break line), up arrow not working - use that command for set true xkb map.

:100 - Display number with control of xpra

:200 - Display number control of Xephyr

May be that command help, if you use x2go and mate desktop environment (if x2go settings keyboard on client turned off)