You are not logged in.

#1 2021-10-15 21:40:13

emil.s
Member
Registered: 2011-05-22
Posts: 11

Unable to change keyboard layout behind VNC session

Hello!

I'm accessing a Linux host that's running behind a VNC connection. I have no access to the VNC client, but I have full access to the Linux host in the backend.
The issue is that I'm using dvorak as my main keyboard layout, but I just can't get it working on the remote host.

This is the default setup (after reboot):

$ setxkbmap -query
rules:      evdev
model:      ps105
layout:     us
$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)"        };
        xkb_geometry  { include "pc(pc105)"     };
};

And this is the "KeyPress" events from evdev, for [qwe]:

KeyPress event, serial 40, synthetic NO, window 0x7c00001,
    root 0xfd, subw 0x0, time 128831773, (155,-21), root:(155,16),
    state 0x0, keycode 252 (keysym 0x71, q), same_screen YES,
    XLookupString gives 1 bytes: (71) "q"
    XmbLookupString gives 1 bytes: (71) "q"
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x7c00001,
    root 0xfd, subw 0x0, time 128833345, (155,-21), root:(155,16),
    state 0x0, keycode 251 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x7c00001,
    root 0xfd, subw 0x0, time 128835080, (155,-21), root:(155,16),
    state 0x0, keycode 253 (keysym 0x65, e), same_screen YES,
    XLookupString gives 1 bytes: (65) "e"
    XmbLookupString gives 1 bytes: (65) "e"
    XFilterEvent returns: False

I've been reading the following pages in the wiki:
https://wiki.archlinux.org/title/X_keyboard_extension
https://wiki.archlinux.org/title/Xmodmap

The first thing I tried was just some simple edits with xmodmap.
Things like:

# Swap q and w:
$ xmodmap -e "keycode 251 = q"
$ xmodmap -e "keycode 252 = w"
# and/or
$ xmodmap -e "keysym q = w"
$ xmodmap -e "keysym w = q"

I then proceeded with downloading the keyboard layout using xkbcomp.
I did some edits, and uploaded it successfully (just some warnings).

But still no change in the actual layout. sad

Feels like I've spent way to much time now on a such trivial problem.
Does anyone here have any other idéa about how to approach this issue?

Best regards
Emil

Offline

#2 2021-10-16 13:50:24

roccobaroccoSC
Member
Registered: 2021-10-04
Posts: 16

Re: Unable to change keyboard layout behind VNC session

VNC's keyboard handling behaves very strangely and I haven't still figured it all out.
I have a similar problem when I share screen with a friend.

He uses a couple of keyboard layouts - US, BG, DE and I use DE and BG. My keyboard is German(DE).
I am the VNC client, he is the VNC server.

When I want to type BG on his screen , mostly it is all messed up. The only combination that works is when I set my local layout to DE and his to BG.

So to recap, the VNC server must have the keyboard layout you need installed. Then you select your main layout on the VNC client (for example DE in my case) and inside the VNC window you select the target layout (BG). Then and only then it works.

And still I experience a couple of glitches but that's the best I have come up with.

Offline

Board footer

Powered by FluxBB