Skip to content

Keyboard layout messed up for KBD_PORTUGUESE_BRAZILIAN_ABNT2. #27

Closed

Description

When I try to type any text on any of the GUI applicatuins, the letter doesnt matches the keyboard layout (it works just fine from the command prompt).

Activity

  1. hideyukn88 commented on Apr 22, 2021

    @hideyukn88
    Contributor

    Thiago Bachi Rehbein (@tb110188) , would you please attach weston.log from /mnt/wslg ? and what keyboard layout do you use in Windows side ?

  2. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    Thiago Bachi Rehbein (@tb110188) , would you please attach weston.log from /mnt/wslg ? and what keyboard layout do you use in Windows side ?

    i'm reinstalling Ubuntu... And sure, also I do use PT BR (ABNT2)

  3. jordan080 commented on Apr 22, 2021

    @jordan080

    I'm having the same issue. My keyboard layout is PT-BR (ABNT2) too, and here's my weston.log file:

    weston.log

  4. tb110188 commented on Apr 22, 2021

    @tb110188
    Author
  5. hideyukn88 commented on Apr 22, 2021

    @hideyukn88
    Contributor

    From your weston.log.

    [23:07:28.183] kbd_layout:0x416 kbd_type:0x4 kbd_subType:0x0 kbd_functionKeys:0xc

    RDP client is correctly reports 0x416, which is ...

    #define KBD_PORTUGUESE_BRAZILIAN_ABNT 0x00000416

    Would you please do "setxkbmap -print -verbose 10" on Linux side to see if corresponding layout is installed/configured in Xkb ?

  6. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    Setting verbose level to 10
    locale is C
    Trying to load rules file ./rules/evdev...
    Trying to load rules file /usr/share/X11/xkb/rules/evdev...
    Success.
    Applied rules from evdev:
    rules: evdev
    model: pc105
    layout: us
    Trying to build keymap using the following components:
    keycodes: evdev+aliases(qwerty)
    types: complete
    compat: complete
    symbols: pc+us+inet(evdev)
    geometry: pc(pc105)
    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)" };
    };

  7. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    weston.log

    also here is my weston.log

  8. jordan080 commented on Apr 22, 2021

    @jordan080

    From your weston.log.

    [23:07:28.183] kbd_layout:0x416 kbd_type:0x4 kbd_subType:0x0 kbd_functionKeys:0xc

    RDP client is correctly reports 0x416, which is ...

    #define KBD_PORTUGUESE_BRAZILIAN_ABNT 0x00000416

    Would you please do "setxkbmap -print -verbose 10" on Linux side to see if corresponding layout is installed/configured in Xkb ?

    My output from "setxkbmap" is pretty much the same as that of Thiago Bachi Rehbein (@tb110188):

    Setting verbose level to 10
    locale is C
    Trying to load rules file ./rules/evdev...
    Trying to load rules file /usr/share/X11/xkb/rules/evdev...
    Success.
    Applied rules from evdev:
    rules: evdev
    model: pc105
    layout: us
    Trying to build keymap using the following components:
    keycodes: evdev+aliases(qwerty)
    types: complete
    compat: complete
    symbols: pc+us+inet(evdev)
    geometry: pc(pc105)
    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)" };
    };

  9. hideyukn88 commented on Apr 22, 2021

    @hideyukn88
    Contributor

    Assuming you are on Ubuntu, can you configure keyboard layout using "sudo dpkg-reconfigure keyboard-configuration" and restart WSLg by wsl --shutdown or wsl --terminate [distro name] ?

  10. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    Hideyuki Nagase (@hideyukn88) Nope, still the same issue...

  11. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    when I try to type "qwerty" this is what it shows "/,.hxw"...

  12. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    I don't know exactly what i did, i installed full gnome pckages and change my locale to pt_BR.UTF8, also changind some stuff related to the keyboar... and now it's working just fine...

  13. jordan080 commented on Apr 22, 2021

    @jordan080

    I don't know exactly what i did, i installed full gnome pckages and change my locale to pt_BR.UTF8, also changind some stuff related to the keyboar... and now it's working just fine...

    What exactly did you change in the keyboard settings? And did you install the full GNOME DE?

  14. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    I don't know exactly what i did, i installed full gnome pckages and change my locale to pt_BR.UTF8, also changind some stuff related to the keyboar... and now it's working just fine...

    What exactly did you change in the keyboard settings? And did you install the full GNOME DE?

    Tried again, but without installing Full Gnome Desktop Experience...

    I think we need that...

  15. tb110188 commented on Apr 22, 2021

    @tb110188
    Author

    Update:

    We don't need Gnome Desktop Experience, but i don't know what else...

  16. 70 remaining items

  17. hideyukn88 commented on Feb 16, 2022

    @hideyukn88
    Contributor

    Roberto Alves Neto (@robertoalvesneto), thanks for detail info, WSL alone doesn't manage keyboard layout, but WSLg does. In your case, VcXsrv is being used instead of WSLg, you might need to follow up with VcXsrv. Thanks!

  18. robertoalvesneto commented on Feb 24, 2022

    @robertoalvesneto

    Hideyuki Nagase (@hideyukn88) thanks for your answer! I installed VcXsrv a long time ago and i didn't even know WSLg. I uninstalled VcXsrv and updated all. I still have problems but at least they are new problems 😆.
    For anyone else who has similar keyboard problems, check three things:

    • What GUI you use;
    • wayland or x11;
    • you launch your apps by bash or zsh;

    In my case, change to wayland made the gnome theme work

    export GDK_BACKEND=wayland

    For my, run source ~/.zshrc was not enough, it gave an error of DISPLAY :0, so, try reboot your wsl.

    And launch my apps by bash instead of zsh made my keyboard language work.

    I still don't know how to make the keyboard preferences work by launching the app from zsh, but I've made some progress.

    References that helped me:

    reddit WSLg vs VcXsrv
    Context menu doesn't respect screen bounds #641

  19. gmazoni commented on Apr 22, 2022

    @gmazoni

    This is how I persist the configuration with /etc/wsl.conf

    [user]
    default=guilherme
    
    [boot]
    command="export WAYLAND_DISPLAY='wayland-1' && setxkbmap -model abnt2 -layout br -variant abnt2"
    
  20. hideyukn88 commented on Apr 22, 2022

    @hideyukn88
    Contributor

    Guilherme Mazoni (@gmazoni), do you still see the issue (without applying your workaround) even using the latest WSL from aka.ms/wslstorepage? thanks!

  21. gmazoni commented on Apr 22, 2022

    @gmazoni

    Guilherme Mazoni (@gmazoni), do you still see the issue (without applying your workaround) even using the latest WSL from aka.ms/wslstorepage? thanks!

    Hi Hideyuki Nagase (@hideyukn88), thanks for replying, I updated the WSL and it solved my problem, I removed the wsl.conf and checked all my rc profiles to not export and execute setxkbmap.

  22. thomassalmeida commented on Jun 20, 2022

    @thomassalmeida

    Tried all of Paulo Sérgio Cotrim (@PauloCotrim) solutions, and none of these work

    first step, configure your locale

    sudo dpkg-reconfigure locales

    on the screen scroll down and choose pt_BR.UTF8

    then next you will do ok and ok, and run this on the command line

    sudo update-locale LANG=pt_BR.UTF8

    in the end you run this

    setxkbmap -model abnt2 -layout br -variant abnt2

    and don't restart WSL yet, just try...

    It worked like a charm. Thanks.

  23. laheinzen commented on Aug 20, 2022

    @laheinzen

    Nothing of the above was working in a way that I liked in Win11. I wanted this to be automatic, and my choices (done in bashrc and wsl.conf) didn't work. This required running the command again. Also, sometimes it failed, even with the command.

    Simplest workaround: changing the keyboard layout in Windows, from ABNT2 to ABNT. The Alt Gr key still works in Windows, and it is now working 100% on WSLg without any additional configuration.

  24. marcioandradejs commented on Sep 5, 2022

    @marcioandradejs

    setxkbmap -model abnt2 -layout br -variant abnt2

    zsh: command not found: setxkbmap

    SOLUTION
    sudo apt-get update sudo apt-get install x11-xkb-utils

    DONE! =D

    https://command-not-found.com/setxkbmap

  25. Ri0n commented on Nov 21, 2022

    @Ri0n

    I have a pretty similar problem.
    My Windows layouts ru, en.
    Tested with gvim with Ubuntu 22.04. I can switch from en to ru with a hotkey but not back. only setxkbmap -layout us switches back to us.
    In terminal as usually all works well.

  26. kierke-gaard commented on Nov 22, 2022

    @kierke-gaard

    same here. I have German and US key-baord layout installed for Windows. When I switch to US layout and start wsl2, I have also us layout in the wsl2 bash. But emacs started from this bash has then German keyboard layout. really annoying, as emacs becomes useless with this keyboard layout :(

  27. nascimento210 commented on Feb 5, 2023

    @nascimento210

    I don't know if matters, but I noticed that when I change the keyboard layout on windows the keyboard on linux gui app starts to work properly, maybe the solution is on what happen when we refresh the keyboard on windows.

  28. MouraVocal commented on Feb 28, 2023

    @MouraVocal

    For my pt-br keyboard worked these steps:

    1- in your zsh terminal type:

    sudo dpkg-reconfigure locales
    

    select PT-BR UTF-8 with space key on keyboard and click "ok"

    2 - type a new command on terminal:

    sudo apt update && sudo apt install x11-xkb-utils
    

    3 - On your ~/.zshrc file adds the lines:

    setxkbmap -model abnt2 -layout br -variant abnt2
    WAYLAND_DISPLAY="wayland-1"
    

    Don't forget to restart terminal for load zshrc file changes.

    If you do not use Zsh, try to edit ~/.bashrc file instead

    thanks Marcio Andrade (@marcioandradejs) and Paulo Sérgio Cotrim (@PauloCotrim) for the references

  29. dmajkic commented on Mar 16, 2023

    @dmajkic

    When I switch keyboard layouts in windows, both "Serbian Latin" and "Serbian Cyrilc" keyboard layouts print cyrilic chars in WSL2 Wayland apps. Sloveninan, which I have also installed, is recognized OK and prints latin chars just fine.

    $ setxkbmap -query
    rules:      xorg
    model:      pc104
    layout:     rs
    variant:    latinalternatequotes
    options:    lv3:ralt_switch
  30. perryrip commented on Aug 2, 2023

    @perryrip

    I have the same problem but I can't try the solutions proposed here because I use openSUSE Tumbleweed and some commands from the solutions are exclusive to ubuntu. ANyone know how to fix the issue on openSUSE? I'm using abnt, not abnt2.

  31. cassiocsantana commented on Jan 15, 2024

    @cassiocsantana

    Does anyone know how to persist, wsl.conf is not being executed, because I added 'command = ' and it didn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions