Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on How to change the keyboard layout with Gnome and Arch linux?

Parent

How to change the keyboard layout with Gnome and Arch linux?

+2
−0

My goal is to use a french AZERTY keyboard layout with Arch linux and Gnome desktop environment but use US English as "OS language".

Note that I am also open to a "working" solution on any other desktop environment than Gnome as long as I can run a GUI web browser with it.

Attempts

During the install I just done:

loadkeys fr-latin1

And everything was fine (i.e. the keyboard layout instantaneously changed correctly).

But after the install, during first boot of the OS, I noted that the keyboard was set to "QWERTY" when I tried to log in my user session.

I tried a lot things, like the below commands, but it seems that "nothing" append:

loadkeys fr-latin1
setxkbmap fr
localectl set-x11-keymap fr
localectl set-keymap fr-latin1

The content of /etc/X11/xorg.conf.f/00-keyboard.conf is currently

Section "InputClass"
    Identifier "system-keyboard"
    MatchIsKeyboard "on"
    Option "XkbLayout" "fr"
    Option "XkbModel" "pc105"
    Option "XkbVariant" "latin1"
EndSection

But the keyboard layout remains in QWERTY...

Additional materials

In /etc/locale.gen file, only these 4 lines are uncommented:

en_US.UTF-8 UTF-8
en_US ISO-8859-1
fr_FR.UTF-8 UTF-8
fr_FR ISO-8859-1

Output of locale-gen command:

Generating locales...
    en_US.UTF-8... done
    en_US ISO-8859-1... done
    fr_FR.UTF-8... done
    fr_FR ISO-8859-1... done
Generation complete.

LANG variable created with:

echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

N.B. I use a fresh install of Arch, so I can reinstall it easily if necessary.

N.B. I am completely new to Arch.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+3
−0

As the keyboard layout wiki suggests, loadkeys only sets the keyboard layout for the current session. In order to persist these changes, the KEYMAP variable must be set in /etc/vconsole.conf. This is exactly what is happening when executing

localectl set-keymap --no-convert fr-latin1

However, this would only update the configuration on the keyboard layout used in the console!

To additionally update the Xorg server keyboard layouts, you would run the latter command without the --no-convert flag. However, I am not sure whether there is an equivalent for Wayland. These would be the keyboard layouts that would typically be used in the graphical user interface.

GNOME typically ignores the general Xorg settings in favour of its own configuration system. According to the GNOME wiki this can be managed by gsettings and/or dconf. However, for me only dconf seems to read/modify the actual settings and gsettings does nothing. The current keyboard layout(s) can be displayed using both tools:

dconf read /org/gnome/desktop/input-sources/sources
gsettings get org.gnome.desktop.input-sources sources

I think it should be clear from the output of these two commands what tool to use. Assuming that you wish to overwrite any existing settings, you can simply use

dconf write /org/gnome/desktop/input-sources/sources "[('xkb', 'fr')]"
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'fr')]"

I am not quite sure about the gsettings syntax, though, so feel free to let me know if this needs modification.

In the end, changing the keyboard layout in the GNOME Settings panel comes down to exactly invoking these commands in a convenient way. That is why you probably want to stick with the answer from InfiniteDissent, but this is what's happening under the hood.

PS: if you also want the keyboard in your (virtual) consoles to be updated, you will have to make sure /etc/vconsole.conf is set accordingly (on top of setting your GNOME keyboard layout).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Works for me (3 comments)
Works for me
zetyty‭ wrote over 1 year ago · edited over 1 year ago

The keyboard layout is correctly changed everywhere: terminal/console and in log in screen (it was not the case with changing the GNOME Settings panel GUI, see this comment) and it is persistent after reboot.

I used exactly what was proposed in this answer, i.e. the following commands: localectl set-keymap --no-convert fr-latin1, localectl set-keymap -convert fr-latin1 and dconf write /org/gnome/desktop/input-sources/sources "[('xkb', 'fr')]" (I also tested gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'fr')]" and obtained the same expected results).

The syntax is correct for all proposed gsettings and dconf command lines.

Lorenzo Donati‭ wrote over 1 year ago

zetyty‭ You should edit the info about the solution that worked for you into your question, so that it is more prominent and doesn't get lost in the future. Comments are inherently transient.

zetyty‭ wrote over 1 year ago · edited over 1 year ago

Lorenzo Donati‭ IMHO the "solution" doesn't belong to the question ;-)

So I used the "react" button and gave in to the pop-up invitation to post a comment (after your comment I realised that this was a mistake because my comment gives the impression that I didn't use exactly what was proposed in the answer but in reality I used exactly what was proposed, no more and no less.)...

After your comment I edited my comment to make it clear that everything in the answer works for me (in order to avoid misunderstanding).

Next time I'll try to think twice before posting this kind of comment...

Either way, thanks!