Quick and easy: copy the line below and paste in a terminal:
Some more explanation: Two methods for a test-run. But: please check if the Western European layout is (already) available in the keyboard configuration tools (gnome-control-center, at the very bottom of this page) before you unnecessarily start modifying files. This is last updated in April of 2021 (when we were still working on this proposal).
Make two directories (inside the hidden .config directory) to hold two files. Download the layout (file: altgr-weur) and the keyboard setup (file: map):
Next, compile and activate the new map for the current display ($DISPLAY):
"Success" means there is no further output. Press AltGr+'d': you should see é (and not ð - if you were using altgr-intl before). The right Ctrl key serves as Multi_Key (or Compose) key. Once you're done testing: log out, log in again and your keyboard layout will be back the way it was. (The two small files will remain - for the next session, repeating just the xkbcomp command will suffice.)
You could do all of the above in one move:
That last command will download a small script ('program') with the manual procedure above and start executing it right away. Do this only if you think that altgr-weur.sh does not contain malware. It doesn't, but I wouldn't take anyone's word for it (hint: use the hyperlink to see what's in it).
The Linux 'user' version of AltGr-WEur is kindly provided by Enno Nagel.
You will need superuser access and you will need to know where the X11 directory is on your distribution for this to work (this directory is not the same on all distros). Change your current directory and start editing the file 'us' as superuser (you are now warned). (Substitute 'nano' with any other text editor you like: gedit (graphical), vi (die-hards), ...)
Insert altgr-weur just below altgr-intl (or at the very bottom of the
Insert altgr-weur_evdev.xml just below the section of
Add the following line just below altgr-intl
Now, you have modified the config files, but the different tools need to pick up the changes. On some (Debian
based) distros you could:
...but a reboot seems to work on all distros. Next, you will need to select the new layout for your keyboard:
To select the layout, find "Region & Language", click "+" to add an input source, choose "English(US)" as your QWERTY keyboard, followed by "Western European AltGr dead keys". The layout(s) can be activated by pressing the Super (or Windows) key and the space bar. (An IBM model M lacks that key: head over to keyboard settings in Devices->Keyboard and select another keyboard shortcut for "Switch to next input source", or use your CapsLock as Super key.)