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

Post History

71%
+3 −0
Q&A How to change the keyboard layout with Gnome and Arch linux?

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. Thi...

posted 10mo ago by mr Tsjolder‭

Answer
#1: Initial revision by user avatar mr Tsjolder‭ · 2023-07-28T09:06:58Z (10 months ago)
As the [keyboard layout wiki](https://wiki.archlinux.org/title/Linux_console/Keyboard_configuration) 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
```sh
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](https://wiki.archlinux.org/title/GNOME#Configuration) 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:
```sh
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
```sh
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](https://linux.codidact.com/posts/289105/289106#answer-289106), but this is what's happening under the hood.

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