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
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 4
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)
Solution 5
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).
qedi
Updated on September 17, 2022Comments
-
qedi over 1 year
When I start up Xephyr inside of X, my keyboard map becomes wonky mostly just for non-printing characters. I can't use arrow keys. According to xev, The down arrow gets mapped to Super_R. The up arrow is Print Screen. PgDown is mapped to "Menu". My keyboard works fine in the original X display (:0), but in the Xephyr subdisplay (:1), nothing else quite works right.
I don't have any funky xmodmap things going on in my main X display that I'm aware of. All I really do is
setxkbmap -option ctrl:swapcaps
.-
Admin over 14 yearsYou're not using SSH, right? Or in other words: you're using the exact same keyboard and X server with Xephyr like you use without it? And any better results when using the older
Xnest
? I don't know how that knowledge will help you, but maybe it does. ;-) -
Admin over 14 yearsYep. no ssh. Same keyboard and server. I'll try Xnest.
-
Admin over 14 yearsXnest did the same thing, but at least it pointed me to the solution.
-
-
qedi over 14 yearsThat makes some other keys work, but not all. xev claims, for example that the keypad slash is XF86_Ungrab, not KP_Divide as it is defined in the xmodmap file I've dumped and used.
-
Arjan over 14 yearsAnd no more need for
xmodmap
either, I hope? Good find! -
Arjan over 14 years(I think you can accept your own answer after 48 hours? Please come back to do so. Thanks!)
-
Alexis Winters about 13 yearsIn this answer I indicate how to launch Xephyr to have it properly configured.
-
Alexis Winters about 13 yearsI found a better solution: see my other answer to this question.
-
bwDraco over 9 yearsPlease explain what this code does—this isn't very helpful as it stands.
-
Olaf Dietsche about 8 yearsThere's no need for all the empty commas, just list keyboard options as needed. In my case it is
-keybd ephyr,xkbmodel=evdev,xkblayout='de(nodeadkeys)'