If you'd like to start a script when Gnome is starting, look here. Putting an setxkbmap
in .bashrc
won't help if the X server is not running (yet) and if you're not (manually!) starting a terminal each time after the X server starts. Caveat: I haven't tried either 'solution', because I verified the solution below and it works:
If you edit two files (as superuser - be careful!) on your system, you could have each user configure the layout for themselves and never worry about it again:
sudo nano /usr/share/X11/xkb/rules/evdev.xml
and insert the following just below the variant altgr-intl:
<variant>
<configItem>
<name>eu</name>
<!-- Keyboard indicator for European layouts -->
<shortDescription>eu</shortDescription>
<description>EurKEY (US based layout with European letters)</description>
<languageList>
<iso639Id>cat</iso639Id>
<iso639Id>dan</iso639Id>
<iso639Id>eng</iso639Id>
<iso639Id>est</iso639Id>
<iso639Id>fao</iso639Id>
<iso639Id>fin</iso639Id>
<iso639Id>ger</iso639Id>
<iso639Id>gre</iso639Id>
<iso639Id>gsw</iso639Id>
<iso639Id>ita</iso639Id>
<iso639Id>lav</iso639Id>
<iso639Id>lit</iso639Id>
<iso639Id>nld</iso639Id>
<iso639Id>nor</iso639Id>
<iso639Id>por</iso639Id>
<iso639Id>spa</iso639Id>
<iso639Id>swe</iso639Id>
</languageList>
</configItem>
</variant>
(I took this from /usr/share/X11/rules/evdev.extra.xml
and replaced layout
with variant
. Note that French is missing: you will not find this variant if you choose French (see below).) Next edit:
sudo nano /usr/share/X11/xkb/rules/xorg.lst
and insert one line below altgr-intl:
eurkey us: English (US based layout with European letters)
The last thing you need to do is to reconfigure the xkb-data:
sudo dpkg-reconfigure xkb-data
Now, the user will be able to run gnome-control-center
(aka 'Settings'), go to 'Region and Language' and add a keyboard layout:

Choose English (United States)
and see this after you scroll down quite a bit:

Choose EurKEY and that user is done, even when the system is shutdown and rebooted. In other words: the setxkbmap eu
is no longer necessary!
There might be something wrong with the way EurKEY is integrated. The setxkbmap eu
works out-of-the-box on my Ubuntu 20.04, but I cannot find it anywhere in the gnome-control-center
(if that's what is meant by "keyboard layout configuration panel" on the EurKEY website).
On their website, there is an eurkey.deb
. Looking inside (ar -x eurkey.deb
and tar xvf control.tar.gz
) we find a postinst
script that edits some xml files in /usr/share/X11/xkb/rules
. The edits are different from what is distributed but I used it to see how they did it. They're adding a layout called eu
, but I don't know how to select the language eu
. Then again, I'm no expert.
We did develop an alternative for altgr-intl
that suits European languages a bit better and in the process we had to do something similar for the new layout.
Keyboard layouts that suit everyone are hard to make. EurKEY was made in Germany and it shows: the Portugese use a-tilde and o-tilde a lot, but it's not on EurKEY. I like our new altgr-weur better, but I'm biased!
systemctl start eurkey.service
does it find and execute your scripts? I also notice that the permissions of the service files that I have in /etc/systemd/system/default.target.wants are 777 (as opposed to 664) – Charles Green Mar 28 '21 at 19:25setxkbmap
command at boot, because this command needs an active X server and there is no X server running at the moment the system boots. You probably need to run this in X session startup programs, not at boot. – raj Mar 28 '21 at 19:31