This worked and was tested in X11, and should work for Wayland as well as per this discussion about the Wayland protocol. This method will be portable to any operating system using Xorg. Here is what has worked for me:
Create a directory to save your custom keymap to, I like to create a .settings folder in my home directory, and create a subfolder named keyboard just to keep things organized.
Create a file that will contain your keymap, say uc (a play on the 'us' keymap, but with a 'c' custom) with the following lines
default partial alphanumeric_keys
xkb_symbols "uc" {
name[Group1]="uc";
include "us(basic)"
include "level3(ralt_switch_multikey)"
};
Here we basically just copy the default us keymap with the line include "us(basic)", and I chose to set the right alt to be my level 3 shift, which will be our custom symbols. This choice was somewhat arbitrary, and there are many other options you could choose that are all listed in the file
/usr/share/X11/xkb/symbols/level3
At this point run the following command to ensure that there are no typos or errors in our script setxkbmap ./uc.
- Let's add the symbols we want to our keyboard layout. For example, I am going to add the symbol
U2200 (for all symbol) to the letter a. This is done by adding the following line beneath the second include statement:
key <AC01> { [a, A, U2200 ] };
Saving this file and running setxkbmap ./uc will now add that symbol to the keyboard, and by holding the right alt key down, pressing a produces a ∀ symbol. In this line, the <AC01> means we are going to be defining the a key on the keyboard, in the xkb_symbols section in this document, the rows of the keyboard are denoted AA, AB, AC, AD, and AE from bottom to top, and individual keys are listed 01 to the end of the keyboard (I haven't experimented much with this, but modifier keys and Tab are not counted, so z, a, and q are all key number 01 in their row), so the key AC01 is the first non-modifier key on the third row up of the keyboard, or rather, the a key. We then tell xkb to set the values of this key to a, A, and U2200 for levels one, two and three, respectively. Don't forget to list the actual letters for the key first, or you will not be able to type those characters after setting this as your keymap. Doing this for each of the keys you wish to edit will give you the symbols you wish to add to your keymap.
At this point, we have done enough to be able to set this as our keymap. To see how to make these changes permanent and be able to access our new keymap in keyboard menus in system settings, see my other answer here. This basically consists of linking this file to the right spot, and adding an entry for it in the evdev.xml file so your system can access it.
Good luck!