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 GUI keyboard configuration tools (gnome-control-center, at the very bottom of this page) before you unnecessarily start modifying files. As of May 2022, this layout is included in Debian (unstable); expect to be able to select the layout from a GUI on mayor distros within a year.
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 as described below.
First, you need to enable selecting more layouts than the popular ones. This can be done by throwing the switch Show Extended Input Sources in 'gnome-tweaks', under Keyboard & Mouse.
You may need to install 'gnome-tweaks' first:
Next, start gnome-control-center (the 'main' settings tool for Gnome).
To select the layout, find Region & Language or Keyboard, 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.)