You are not logged in.

#1 2023-11-12 12:48:57

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

[SOLVED] Change on keyboard layout not applied on terminals/apps

I just installed the latest version of Arch Linux in a VM with GNOME and XFCE environments. During the installation I set as language, keyboard layout, and locale the italian related values.

Now I want to switch to US keyboard layout (keeping Italian language on the system). According to the Arch Wiki, I am able to change the keyboard layout by "localectl set-keymap us" and reboot. Indeed this command changes "/etc/vconsole.conf" as:

KEYMAP=us
XKBLAYOUT=us
XKBMODEL=pc105+inet
XKBOPTIONS=terminate:ctrl_alt_bks

It creates also the file "/etc/X11/xorg.conf.d/00-keyboard.conf" as:

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
        Option "XkbModel" "pc105+inet"
        Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

"localectl" command returns:

System Locale: LANG=it_IT.UTF-8
    VC Keymap: us
   X11 Layout: us
    X11 Model: pc105+inet
  X11 Options: terminate:ctrl_alt_bksp

The list of env variables is:

SHELL=/usr/bin/bash
SESSION_MANAGER=local/archlinux:@/tmp/.ICE-unix/928,unix/archlinux:/tmp/.ICE-unix/928
COLORTERM=truecolor
XDG_MENU_PREFIX=gnome-
TERM_PROGRAM_VERSION=45.0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
DESKTOP_SESSION=gnome
DBUS_STARTER_BUS_TYPE=session
PWD=/home/user
LOGNAME=user
XDG_SESSION_DESKTOP=gnome
XDG_SESSION_TYPE=wayland
SYSTEMD_EXEC_PID=928
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.QVUOE2
MOTD_SHOWN=pam
GDM_LANG=it_IT.UTF-8
HOME=/home/user
USERNAME=user
LANG=it_IT.UTF-8
XDG_CURRENT_DESKTOP=GNOME
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-gnome\x2dsession\x2dmanager.slice/gnome-session-manager@gnome.service/memory.pressure
VTE_VERSION=7401
WAYLAND_DISPLAY=wayland-0
INVOCATION_ID=e1d2b225ef684376bf43e99520373193
MANAGERPID=825
GNOME_SETUP_DISPLAY=:1
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=user
DISPLAY=:0
SHLVL=1
DBUS_STARTER_ADDRESS=unix:path=/run/user/1000/bus,guid=1f974e1c04e328f9389e7e256550ca9e
XDG_RUNTIME_DIR=/run/user/1000
DEBUGINFOD_URLS=https://debuginfod.archlinux.org 
JOURNAL_STREAM=8:7962
XDG_DATA_DIRS=/home/user/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
GDMSESSION=gnome
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus,guid=1f974e1c04e328f9389e7e256550ca9e
MAIL=/var/spool/mail/user
TERM_PROGRAM=kgx
_=/usr/bin/env

As expected, my TTY environment seems to work correctly with US keyboard layout. Also GDM takes as input the correct US keyboard layout when I must login.

What is not working is the US keyboard layout in my terminal in the GUI environments, both in GNOME terminal and XFCE4 terminal in GNOME environment, and also other applications like gedit. Here, the layout remains as Italian.

It is a default Arch environment, so I don't have in $HOME folder any .xinitrc or .Xresources file there.

Is there a way to switch completely to US keyboard by CLI command?

And, in particular, the command "localectl set-keymap us" edit only "/etc/vconsole.conf" and "/etc/X11/xorg.conf.d/00-keyboard.conf"?

Last edited by D3vil0p3r (2023-11-12 16:29:13)

Offline

#2 2023-11-12 14:57:23

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,325

Re: [SOLVED] Change on keyboard layout not applied on terminals/apps

Your keyboard layout is completely unrelated to the locale, vconsole.conf is only relevant for the console, not GUI sessions or virtual terminal emulators therein.
The sane approach to configure multiple keyboard layouts (setxkbmap has side-effects) is https://wiki.archlinux.org/title/Xorg/K … rd_layouts

/etc/X11/xorg.conf.d/00-keyboard.conf will be interpreted by the X11 server and most likely GDM/Gnome/wayland, but there's also a decent chance that your DE re-configures the keyboard layout based on a per-user/per-session config, ie. you'll have to adjust this in the config dialog of your DE.

Inside xfce4 "setxkbmap -layout us"  will change the layout to US, inside gnome (on wayland) that'll most likely not work (idg. whether gnome provides and CLI tools other then maybe dconf, gsettings or dbus-send where you'd have to operate on its private config structure - what might not even have immediate impact)

Offline

#3 2023-11-12 16:28:39

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Re: [SOLVED] Change on keyboard layout not applied on terminals/apps

Yes. True. Compositors manage this topic in different manner. Indeed in GNOME Wayland it is needed to use:

gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us')]"

Indeed it solved my issue. Thank you

Offline

Board footer

Powered by FluxBB